Notestransactions🌱 seedling

Actual Serial Execution

Also: Serial Execution · Single-Threaded Transactions · Partitioned Serial Execution · H-Store

Run transactions literally one at a time, on one thread per partition, with all data in memory. With no concurrency there's nothing to lock, so every schedule is serial by construction.

Why it exists

RAM became cheap enough to hold OLTP data sets, and OLTP transactions are short. A 2008 study of an in-memory OLTP engine found about a 20× difference in raw performance once logging, latching, locking and buffer management were stripped out, with no single dominant cost.

How it works

  • Each partition is owned by one thread on one core; the thread runs transactions back to back from a queue.
  • Transactions are submitted whole as stored procedures, so the thread never waits on the network mid-transaction.
  • Procedures must be deterministic, because replicas re-execute them and must reach the same state.
  • Multi-partition transactions are coordinated across all partitions they touch, which stalls them for the duration.

Trade-offs

Gains Costs
serializable with no locks or latches throughput capped at one core per partition
simple, predictable latency for short transactions one slow transaction stalls its partition
no deadlocks cross-partition transactions are slow and don't scale
data set must fit in memory; interactive transactions impossible

In practice

  • VoltDB (from the H-Store research prototype) partitions tables and runs Java or SQL stored procedures serially per partition.
  • Redis executes commands on one thread, so a Lua script or MULTI/EXEC block runs atomically, and a slow script blocks the whole server.

Pitfalls

  • Choosing a partition key that forces common transactions to span partitions.
  • Correct serial execution still depends on correct replication and recovery around it.

Recall

These cards are also in your review deck, scheduled with spaced repetition.