DATA 2027 · Week 05 · Part II — New Access Methods & Engines

Learned Components

ML inside the engine mostly lost; ML advising the engine quietly won — and the LLM agent outside the engine is the strangest winner of all.

Lecture 1 — The case for (and against) learned indexes · Lecture 2 — Bao: ML steering the optimizer

Lecture 1 · Tuesday

The Case For (and Against) Learned Indexes

What if an index is just a model — and the model class is up for debate?

L1 · The provocation

Kraska’s thought experiment (SIGMOD 2018)

L1 · The framing

Every index is a model of the CDF

L1 · The framing

B-trees were models all along

L1 · The hardware bet

Trade pointer chases for FLOPs

  • Learned: two linear layers ≈ 50–100ns total.
  • Pure arithmetic, in registers, predictable.
  • Tree: 3–4 pointer chases through cold DRAM.
  • ≈ 100ns of latency each.
  • On 2018 hardware, FLOPs were nearly free.
L1 · RMI

The recursive model index

L1 · RMI

The error bound makes it correct

L1 · RMI

An index as a CDF model

key position = F(key)·N empirical CDF (the data) RMI leaf models (piecewise linear) ±err bound → binary search the window B-tree = step-function model k
Fig. 5.1 — B-tree: step function, error fixed at one page. RMI: piecewise-linear leaves plus a recorded worst-case error band.
L1 · RMI

The memory result matters more

10–100×

less memory than the B-tree’s index structure — an RMI over 200M doubles fits in a few megabytes, i.e., in L2.

L1 · Updates

Inserts break it — ALEX’s answer

L1 · Updates

PGM-index: a theorem, not a benchmark

L1 · SOSD

SOSD: the honest scoreboard

  • Wins inside the box: read-mostly, in-memory, sorted, numeric.
  • Often 1.5–2× faster lookups at a fraction of the space.
  • Strings: embedding needed; comparison cost dominates.
  • Heavy updates: gap maintenance, merge amortization.
  • Disk: one I/O is 100µs; 200ns saved is rounding error.
L1 · Verdict

What actually shipped

Lecture 2 · Thursday

Bao: ML Steering the Optimizer

Replace the optimizer, or advise it? The answer decided what shipped.

L2 · The opening

The estimates are fiction

10⁴–10⁸×

PostgreSQL’s cardinality errors on Join Order Benchmark multi-joins (Leis et al., VLDB 2015) — independence and uniformity assumptions collapse under correlated predicates.

L2 · Learned cardinalities

Attack one: learn better estimates

L2 · Learned cardinalities

The failure triangle

L2 · Neo

Neo: replace the optimizer

L2 · Bao

Bao: steer, don’t replace

L2 · Bao

The Bao loop

query classical optimizer × 48 hint sets plan 1 plan 2 … plan 48 tree-conv value model: execute best observed latency → Thompson sampling → retrain in minutes every arm = a valid, costed, classical plan
Fig. 5.2 — Bao never generates plans: it picks 1 of 48 hint sets, and the classical optimizer does the rest.
L2 · Bao

The triangle, amputated

L2 · The pattern

Where the ML sits decides the fate

SystemWhere the ML sitsWorst caseFate
Neo (VLDB ’19)Replaces the optimizerArbitrarily bad planInfluential; never deployed as-is
Bao (SIGMOD ’21)Advises: 1 of 48 hint setsA valid classical planPattern adopted (MSFT steered optimizer, Meta AutoSteer & kin)
OtterTune (’17–’24)Outside, tuning knobsBad config (recoverable)Good tech, dead company (2024)
LLM-DBA via MCPOutside, as a clientWhatever you let it executeThe current frontier
L2 · SageDB

SageDB: the manifesto vs. the shipping list

L2 · SageDB

The physics separation

L2 · OtterTune

OtterTune: the product-shape autopsy

L2 · History

Self-tuning is not a 2018 idea

1998

SQL Server 7.0 ships the Index Tuning Wizard. IBM’s LEO was Bao’s feedback loop twenty years early — turned off because customers feared plan instability. The binding constraint is operator trust, not model accuracy.

L2 · The inversion

The learned component moved outside

The systems that shipped all share one clause in their contract: the model advises, the engine decides.
— Week 5 lecture notes, DATA 2027
Checkpoint · Discussion

Before you leave

Readings · Week 05

Read before Thursday