Menu

I wrote a small query engine. It loses to DuckDB most of the time.
📰

I wrote a small query engine. It loses to DuckDB most of the time.

DEV Community: cpp·Abiral pokhrel·6 days ago
#tdU22QLR
#devtocpp#devto#dev#query#rows
Reading 0:00
15s threshold

qe is a columnar analytical query engine in C++20. Parquet in, a SQL subset out, results checked against DuckDB before anything gets timed.

https://github.com/abiralpokhrel-learns/query-engine

I built it because I wanted to know how a database answers a question, and reading about it wasn't enough.

What it does: column pruning, predicate pushdown, row-group skipping, metadata-only COUNT(*) . Vectorized filter, aggregate, hash join, distinct, sort, limit. Hand-written parser and planner. An optional --threads flag decodes row groups in parallel and still emits in serial order. An optional CUDA path for global float aggregates, off by default.

The numbers. 1M rows, same queries and data for both engines, raw runs committed as JSON in the repo.

Single-threaded: qe wins 3 of 8. Four scan threads: 5 of 8. Top-k went 88.81 ms to 39.11 ms, GROUP BY region 92.14 to 39.99, global aggregate 43.81 to 20.42.

The losses are in the table because a benchmark without them is an ad.

The GPU: roughly tied at best.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.