1 hour ago · Tech · 0 comments

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.[......]

No comments yet. Log in to reply on the Fediverse. Comments will appear here.