<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abiral pokhrel</title>
    <description>The latest articles on DEV Community by Abiral pokhrel (@abiralpokhrellearns).</description>
    <link>https://dev.to/abiralpokhrellearns</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273321%2Fa3fedf69-5d63-4fe6-9e0e-208072c3eb5f.png</url>
      <title>DEV Community: Abiral pokhrel</title>
      <link>https://dev.to/abiralpokhrellearns</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abiralpokhrellearns"/>
    <language>en</language>
    <item>
      <title>I wrote a small query engine. It loses to DuckDB most of the time.</title>
      <dc:creator>Abiral pokhrel</dc:creator>
      <pubDate>Mon, 30 Nov 2026 04:26:36 +0000</pubDate>
      <link>https://dev.to/abiralpokhrellearns/i-wrote-a-small-query-engine-it-loses-to-duckdb-most-of-the-time-237j</link>
      <guid>https://dev.to/abiralpokhrellearns/i-wrote-a-small-query-engine-it-loses-to-duckdb-most-of-the-time-237j</guid>
      <description>&lt;p&gt;qe is a columnar analytical query engine in C++20. Parquet in, a SQL subset out, results checked against DuckDB before anything gets timed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/abiralpokhrel-learns/query-engine" rel="noopener noreferrer"&gt;https://github.com/abiralpokhrel-learns/query-engine&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I built it because I wanted to know how a database answers a question, and reading about it wasn't enough.&lt;/p&gt;

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

&lt;p&gt;The numbers. 1M rows, same queries and data for both engines, raw runs committed as JSON in the repo.&lt;/p&gt;

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

&lt;p&gt;The losses are in the table because a benchmark without them is an ad.&lt;/p&gt;

&lt;p&gt;The GPU: roughly tied at best. At 1M rows the transfer costs about what the faster math saves. At 10M rows it's relatively worse. The CUDA path stays opt-in.&lt;/p&gt;

&lt;p&gt;Correctness came before the benchmarks. 208 tests, 74.7% coverage. Every supported query is diffed against DuckDB on generated edge cases, plus a deterministic fuzzer. ASan/UBSan in CI.&lt;/p&gt;

&lt;p&gt;Try it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;micromamba env create -f environment.yml
micromamba activate qe
scripts/build.sh
scripts/demo.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; is next. After that, join ordering, and only GPU work the measurements justify.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>database</category>
      <category>dataengineering</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
