178 days ago · Tech · hide · Fediverse post

When coming from relational databases, NULLs are the go-to for optional fields. Using them in ClickHouse can lead to unexpected and often unnoticeable performance degradation. This article explain why. PostgreSQL When using null values in PostgreSQL, you rarely notice any difference. In PG, columns are nullable by default and you can index them. Internally, each row in PostgreSQL has a bitmap that indicates which columns are NULL. It's only present when there are null values in a particular row using a bit flag. PostgreSQL is a row-oriented database, so when you read a row, you read all the columns together. ClickHouse Unlike PostgreSQL, ClickHouse is a columnar database. Instead of storing data by rows, it organizes them by columns. Each column is stored separately as a contiguous block of data. Let's suppose we have a table that stores HTTP logs. We want to store the visitor's user ID, which can be empty for anonymous users.[......]

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town