Skip to main content
← CONCEPTS / SQL & ANALYTICAL ENGINES
An end-to-end domain learning journey

Apache Arrow Flight &
SIMD Vectorized Columnar Execution.

Vectorized Execution processes 2,048-element contiguous column arrays inside L1/L2 cache using AVX2/SIMD instructions, while Apache Arrow Flight streams identical in-memory RecordBatches over gRPC with zero row serialization.
Start the journey5 sections· Last modified Nov 28, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When building high-throughput OLAP pipelines, pair 2,048-row SIMD vectors and Late Materialization with parallel Arrow Flight `DoGet()` streams.

TL;DR30-second simplified summary
▾

2,048-row vectors fit in L1/L2 cache, Selection Vectors avoid filter copies, Late Materialization skips unused columns, and Arrow Flight streams RecordBatches without serde overhead.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Columnar Storage & CPU Caches
Know why storing values column-by-column lets CPU L1/L2 caches load only queried columns instead of entire wide rows.
gRPC & HTTP/2 Streaming
Understand how HTTP/2 streams multiplex parallel RPC frames over a single TCP connection.
Full walkthrough · 5 stages
01
L4 · FUNDAMENTALS

P · Problem & Why Row-at-a-Time Volcano Iterators Stall CPUs.

In a classic Volcano Filter -> Project -> Scan pipeline, every single row requires 3+ virtual next() calls.

Across 100 million rows, 300 million virtual calls defeat CPU instruction pipelines and branch predictors. Even worse, when Worker A shuffles 1 GB of intermediate rows to Worker B over Protobuf/JSON, both sides spend more CPU encoding and parsing strings/varints than actually running the SUM() or JOIN!

Execution & Wire Efficiency

Row-at-a-Time Volcano + Protobuf vs. Vectorized SIMD + Arrow Flight

Before · Volcano 1-Row + Protobuf
  • 100M virtual next() calls
  • Branch mispredicts on every row
  • Up to 70% CPU spent serializing
After · 2,048-Batch SIMD + Arrow Flight
  • 2,048x fewer virtual calls
  • AVX2 processes 8–16 items/cycle
  • Zero-copy RecordBatch wire transfer
02
L4 · FUNDAMENTALS

R · Representation: Arrow Columnar Buffers & Selection Vectors.

An Arrow RecordBatch stores each column as contiguous byte buffers: a 1-bit Validity Bitmap (for NULLs) plus a flat Values Buffer (or offsets[] + utf8_bytes for strings).

Why 2,048 rows? A 2,048-element int64 vector is 2048 * 8 = 16 KB—so 2–4 active columns fit inside a 32–64 KB L1/L2 CPU cache simultaneously! When a WHERE price > 100 filter runs, the engine doesn't copy surviving rows into a new array; it emits a compact uint16 SelectionVector ([0, 3, 7, ...]) so downstream operators skip non-matching rows in place.

Arrow RecordBatch Layout

2,048-Row Columnar Vectors Fit Inside L1/L2 Cache

03
L5 · APPLIED DESIGN

I · Invariant: Zero-Copy Arrow Flight & Parallel `DoGet()`.

With JDBC/ODBC or JSON, a database server converts internal columnar buffers into row tuples, serializes them, and the client deserializes them back into Pandas/Arrow columns.

Apache Arrow Flight uses the exact same Arrow IPC byte layout in RAM and on the gRPC wire (FlightData message = raw data_header + data_body pointer). The coordinator returns a FlightInfo containing multiple FlightEndpoint tickets; clients open parallel DoGet(ticket) gRPC streams directly to all worker nodes simultaneously.

Parallel Flight Fetch

Client -> Coordinator (GetFlightInfo) -> Parallel DoGet() from Workers

Client / BIFlight CoordinatorWorker 1Worker 21. GetFlightInfo(SQL)2. Return [Ticket1@W1, Ticket2@W2]3. DoGet(Ticket1) -> Zero-CopyBatches4. DoGet(Ticket2) -> Zero-CopyBatches
04
L5 · APPLIED DESIGN

M · Mechanics at Scale: Late Materialization & Dictionary Encoding.

Decoding UTF-8 strings ('US-EAST', 'EU-WEST') for 100M rows burns CPU and cache.

With Dictionary Encoding + Late Materialization, the Parquet scanner keeps low-cardinality strings as 32-bit integer dictionary IDs (0, 1, 2...), runs WHERE region_id == 0 using SIMD vpcmpeqd integer comparisons, and only looks up the actual string text for the tiny surviving result set at the very end!

Vectorized Pipeline

Parquet Scan -> Dict ID SIMD Filter -> Selection Vector -> Arrow Flight

Parquet Column ScaningressAVX2 Dict-ID FiltercomputeSelection Vector(2048)storageArrow FlightShufflecontrol16 KB L1 vectormask surviving rowszero-copy RecordBatch
Engineering Decision Framework
Problem
How to accelerate analytical scans and cross-node shuffles without burning CPU on virtual calls and serialization.
Naive Solution
Use 1-row Volcano iterators and serialize intermediate results as JSON/Protobuf rows.
Why It Fails
Virtual calls and row serialization consume 70%+ of query CPU and thrash L1/L2 caches.
Alternatives
Volcano + Protobuf vs. JIT Codegen vs. 2,048-Batch SIMD Vectorized + Arrow Flight.
Engineering Decision
Use 2,048-row vectorized columnar execution (with Selection Vectors and Late Materialization) paired with zero-copy Arrow Flight gRPC.
Trade-Offs
Requires columnar memory buffers and explicit memory-pool tracking in exchange for 10x–30x CPU speedups.
05
L6 · SCALE & TRADE-OFFS

E · Edge Cases, Assumptions & When NOT to Use Vectorized Columnar.

Vectorized columnar execution shines when scanning/aggregating thousands to billions of rows—it is overkill for single-row OLTP lookups.

When NOT to use Vectorized Columnar / Arrow Flight: (1) Single-row primary-key OLTP lookups (SELECT * FROM users WHERE id = 42)—unpacking 2,048-row columnar blocks wastes I/O and memory compared to a row-oriented B+Tree; (2) Tiny payloads (<1 KB) where gRPC HTTP/2 framing overhead exceeds serialization savings.

Workload Fit

OLAP Scans (Vectorized + Flight) vs. OLTP Point Reads (Row B+Tree)

OLAP Scans / Joins2048-Row SIMD + Flight1-Row Point LookupRow B+Tree (Do NOT…Wide StringsArrow StringView (4B…
Decision Exercise · Make the Call

A team adopts Apache Arrow Flight + 2,048-row vectorized scans for a high-concurrency OLTP user-profile service running 50,000 QPS of SELECT * FROM users WHERE user_id = ? (1 row per query). Latency worsens 5x. Why?

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why do vectorized SQL engines like DuckDB and Velox choose a batch size around 2,048 rows instead of 1 row or 10 million rows?

Recommended Learning Flow