Skip to content
Data
Skill

/mvcc

Overview of Experimental MVCC feature - snapshot isolation, versioning, limitations

From plugin
turso
25k13 skills

Claude Code

$ npx -y skills add tursodatabase/turso --skill mvcc --agent claude-code

SKILL.md

mvcc.SKILL.md
name: mvcc
description: Overview of Experimental MVCC feature - snapshot isolation, versioning, limitations

MVCC Guide (Experimental)

Multi-Version Concurrency Control. **Work in progress, not production-ready.**

**CRITICAL**: Ignore MVCC when debugging unless the bug is MVCC-specific.

Enabling MVCC

PRAGMA journal_mode = 'mvcc';

Runtime configuration, not a compile-time feature flag. Per-database setting.

How It Works

Standard WAL: single version per page, readers see snapshot at read mark time.

MVCC: multiple row versions, snapshot isolation. Each transaction sees consistent snapshot at begin time.

Key Differences from WAL

| Aspect | WAL | MVCC | |--------|-----|------| | Write granularity | Every commit writes full pages | Affected rows only | Readers/Writers | Don't block each other | Don't block each other | | Persistence | `.db-wal` | `.db-log` (logical log) | | Isolation | Snapshot (page-level) | Snapshot (row-level) |

Versioning

Each row version tracks:

  • `begin` - timestamp when visible
  • `end` - timestamp when deleted/replaced
  • `btree_resident` - existed before MVCC enabled

Architecture

Database
  └─ mv_store: MvStore
      ├─ rows: SkipMap<RowID, Vec<RowVersion>>
      ├─ txs: SkipMap<TxID, Transaction>
      ├─ Storage (.db-log file)
      └─ CheckpointStateMachine

**Per-connection**: `mv_tx` tracks current MVCC transaction.

**Shared**: `MvStore` with lock-free `crossbeam_skiplist` structures.

Key Files

  • `core/mvcc/mod.rs` - Module overview
  • `core/mvcc/database/mod.rs` - Main implementation (~3000 lines)
  • `core/mvcc/cursor.rs` - Merged MVCC + B-tree cursor
  • `core/mvcc/persistent_storage/logical_log.rs` - Disk format
  • `core/mvcc/database/checkpoint_state_machine.rs` - Checkpoint logic

Checkpointing

Flushes row versions to B-tree periodically.

PRAGMA mvcc_checkpoint_threshold = <pages>;

Process: acquire lock → begin pager txn → write rows → commit → truncate log → fsync → release.

Current Limitations

**Not implemented:**

  • Garbage collection (old versions accumulate)
  • Recovery from logical log on restart

**Known issues:**

  • Checkpoint blocks other transactions, even reads!
  • No spilling to disk; memory use concerns

Testing

# Run MVCC-specific tests
cargo test mvcc

# TCL tests with MVCC
make test-mvcc

Use `#[turso_macros::test(mvcc)]` attribute for MVCC-enabled tests.

#[turso_macros::test(mvcc)]
fn test_something() {
    // runs with MVCC enabled
}

References

  • `core/mvcc/mod.rs` documents data anomalies (dirty reads, lost updates, etc.)
  • Snapshot isolation vs serializability: MVCC provides the former, not the latter
Read more
@tursodatabase
Ships withturso

A SQL database in Rust: SQLite-compatible, now also speaking Postgres (experimental). The LLVM of databases.

Stars on GitHub

Momentum

stars in total
25.1k
Star history of tursodatabase/turso on GitHub, a chart by star-history.com

Other skills on turso.

async-io-model

async-io-model

Explanations of common asynchronous patterns used in tursodb. Involves IOResult, state machines, re-entrancy pitfalls,…

@tursodatabase@tursodatabaseInstall Skill
cdc

cdc

Change Data Capture - architecture, entrypoints, bytecode emission, sync engine integration, tests

@tursodatabase@tursodatabaseInstall Skill
code-quality

code-quality

General Correctness rules, Rust patterns, comments, avoiding over-engineering. When writing code always take these into account

@tursodatabase@tursodatabaseInstall Skill
debugging

debugging

How to debug tursodb using Bytecode comparison, logging, ThreadSanitizer, deterministic simulation, and corruption analysis tools

@tursodatabase@tursodatabaseInstall Skill
differential-fuzzer

differential-fuzzer

Information about the differential fuzzer tool, how to run it and use it catch bugs in Turso. Always load this skill when running…

@tursodatabase@tursodatabaseInstall Skill
index-knowledge

index-knowledge

Generate hierarchical AGENTS.md knowledge base for a codebase. Creates root + complexity-scored subdirectory documentation.

@tursodatabase@tursodatabaseInstall Skill

More skills from other plugins.

context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,…

mem05d69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and an…

posthog12d41k
@posthog@posthogInstall Skill

Questions about mvcc.

Which coding agents can use mvcc?
mvcc installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.