Tweet by ankrgyl

February 22, 2026

Was talking to someone about "why build your own database" and specifically "how do you beat performance of well known OLAP database X" Here is a good way to think about it -- databases are actually very slow compared to handwritten code. I can write a substantially faster "SELECT COUNT(*) FROM t" with handwritten C++ than the query parsing/optimization/dynamic execution in a database. In fact, some databases (eg Singlestore, Redshift) literally generate and compile code, per plan, to make queries more efficient. So the question is not "how do you perform faster than OLAP database X". It's actually how do you build a system that is sufficiently general for the problem you are trying to solve, without losing too much performance. This is a much harder class of problems. You have to build a really good compiler that inherently supports and optimizes the queries you expect, without over-abstracting (and therefore sacrificing performance) as you add surface area. In the case of braintrust/brainstore (and loosely speaking, observability systems), it's easy for us to beat OLAP databases because they're simply not designed for incredibly sparse and dynamic JSON, full text search on MB+ strings, extremely high cardinality self joins (spans/traces), or running on object storage (at least in OSS). The hard part is adding enough surface area to support the features we want to expose in the UI and giving our users general enough SQL.

Author
ankrgyl
Date
February 22, 2026