Every database query eventually becomes a loop. For decades, the dominant style was the Volcano model (also called iterator or tuple-at-a-time): each operator exposes a next() method that pulls exactly one row from the operator below it. A filter, a join, a projection — each asks the previous layer for one row, processes it, hands it up, and waits.
The model is elegant and easy to compose, but it has a hidden cost. Each next() call carries a function call, a pointer dereference, a type check, a branch, and a loop increment — overhead that has nothing to do with the actual data. When rows are tiny and the computation per row is small, that overhead can be larger than the real work itself.
Vectorized execution — pioneered by Peter Boncz and colleagues in MonetDB/X100 (published 2005) and now the foundation of systems like DuckDB, Velox, and Apache Arrow Compute — attacks this waste at its root. Instead of pulling one row at a time, each operator pulls a vector of 1,000–10,000 values and runs a tight, branch-free loop over the whole batch before yielding to the next operator. The per-call overhead is paid once per batch, not once per row, and the tight inner loop becomes small enough for the CPU to keep in its instruction cache, prefetch data automatically, and — critically — apply SIMD instructions that process multiple values in a single clock cycle.
The result is throughput that can be 10 to 100 times higher than a comparable row-at-a-time engine on the same analytical query.
Comments
Loading comments...