What Is Vectorized Execution?
What is vectorized query execution, and why is it faster than row-at-a-time processing?
Answer out loud in under a minute: a definition, one concrete example, and one pitfall or trade-off.
Hints
Hint 1
Count how many function calls a filter makes over a million rows in each model.
Solution
Show the approach
The short version
A vectorized engine passes batches of column values — thousands at a time — between operators, and each operator runs a tight loop over the batch. Row-at-a-time (Volcano) execution calls next() once per row per operator, paying interpretation overhead on every call and defeating the CPU cache.
Example
A filter amount > 100 over a million rows is a million virtual calls in a row engine, and about a thousand loops over arrays of a thousand values in a vectorized one — loops the compiler can unroll and the CPU can run with SIMD instructions.
Pitfall
Vectorization helps scans and aggregates and does little for operations that are inherently row-by-row, such as calling an opaque user-defined function; the batch size also trades cache fit against per-batch overhead.