LMDB

active

by Symas Corporation / OpenLDAP Project · since 2011 · also known as Lightning Memory-Mapped Database, MDB

Tiny memory-mapped B+tree with ACID transactions and lock-free readers; reached 1.0 in 2026.

key-valueembedded libraryopen source (permissive)mature

Overview

LMDB, written by Howard Chu for OpenLDAP, is a copy-on-write B+tree stored in a single memory-mapped file. Readers never block and never take locks, there is no write-ahead log or recovery step because the file is always consistent, and the whole library is a few thousand lines of C. That makes it exceptional for read-heavy embedded workloads and it is used by OpenLDAP, Monero, Postfix and many language bindings. The constraints are a single writer at a time and a file that must fit within the address space. After years on 0.9.x, LMDB 1.0 was released in 2026 with an on-disk format change, so plan a dump and reload when upgrading.

Strengths & trade-offs

Strengths

  • +Lock-free, zero-copy reads directly from the memory map
  • +Crash-proof copy-on-write design with no recovery or WAL
  • +Full ACID transactions with MVCC snapshots
  • +Tiny C codebase with bindings for nearly every language
  • +Safe multi-process access to one environment

Trade-offs

  • −Only one write transaction at a time
  • −Map size must be set up front and the file never shrinks automatically
  • −Long-lived read transactions prevent page reuse and grow the file
  • −1.0 changes the on-disk format; 0.9 data must be exported and reloaded

Great for

  • +Read-heavy embedded indexes and caches
  • +Directory services (OpenLDAP back-mdb)
  • +Blockchain and wallet state
  • +ML dataset storage with fast random reads

Think twice for

  • −Write-heavy concurrent workloads
  • −Datasets far larger than addressable memory
  • −Network or distributed access

Capabilities

Native or official first-party support · 2 of 25 tracked

✓Transactions
✓Durable persistence
–Joins
–Secondary indexes
–Full-text search
–Vector search
–Geospatial
–JSON
–Change data capture
–Triggers
–Stored procedures
–Materialized views
–TTL / expiry
–Pub/Sub
–Columnar storage
–In-memory
–Compression
–Encryption at rest
–Role-based access
–Time travel
–Branching
–Online schema changes
–Streaming ingest
–Offline sync
–Runs in WebAssembly

Scale & consistency

Comfortable data size
Medium · ≤ 10 TB
Horizontal scaling
None
Multi-region
No
Transactions
Full ACID
Consistency
Strong
Schema
Schemaless
Architecture
Embedded
Query languages
C API

Single file bounded by the configured map size and virtual address space; multi-TB files work on 64-bit systems.

Deployment

Self-hosted Vendor-managed cloud Serverless Embedded Edge Kubernetes operator

Ecosystem

apis & protocolsC API
client languagesC, C++, Python, Go, Rust, Java, JavaScript

Alternatives to LMDB

Compare all→
RocksDBKey-Value48.2

Meta's embeddable LSM-tree key-value engine, the storage layer under dozens of databases.

lmdb vs rocksdb →
bboltKey-Value11.5

etcd's maintained fork of BoltDB: a simple, pure-Go B+tree store in a single file.

lmdb vs bbolt →
redbKey-Value13.8

Pure-Rust embedded key-value store: copy-on-write B-trees, ACID, and a stable file format.

lmdb vs redb →
Oracle Berkeley DBKey-Value17.0

The 1990s-era embedded key-value library, now Oracle-owned, AGPL-licensed and rarely updated.

lmdb vs berkeley-db →
LevelDBKey-Value33.4

Google's original small, fast LSM key-value library, now in limited-maintenance mode.

lmdb vs leveldb →
SQLiteRelational75.5

The in-process SQL engine that ships in every phone, browser and OS: one file, zero servers.

lmdb vs sqlite →

LMDB FAQ

What is LMDB?

LMDB is a key-value database by Symas Corporation / OpenLDAP Project, first released in 2011. LMDB, written by Howard Chu for OpenLDAP, is a copy-on-write B+tree stored in a single memory-mapped file. Readers never block and never take locks, there is no write-ahead log or recovery step because the file is always consistent, and the whole library is a few thousand lines of C. That makes it exceptional for read-heavy embedded workloads and it is used by OpenLDAP, Monero, Postfix and many language bindings. The constraints are a single writer at a time and a file that must fit within the address space. After years on 0.9.x, LMDB 1.0 was released in 2026 with an on-disk format change, so plan a dump and reload when upgrading.

Is LMDB open source?

Yes. LMDB is open source. License: OpenLDAP Public License 2.8.

Does LMDB support ACID transactions?

Yes. LMDB supports full ACID transactions, with strong consistency.

Does LMDB scale horizontally?

LMDB does not scale horizontally; it runs on a single node, so you scale it up rather than out. It is comfortable at medium scale (≤ 10 TB).

How can I run LMDB?

You can self-host it and embed it in your application.

What is LMDB best for?

LMDB is a strong fit for read-heavy embedded indexes and caches; directory services (OpenLDAP back-mdb); and blockchain and wallet state. Think twice for write-heavy concurrent workloads.

What are the best alternatives to LMDB?

Common alternatives to LMDB include RocksDB, bbolt, redb, Oracle Berkeley DB and LevelDB. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.

How popular is LMDB?

LMDB ranks #47 of 844 databases on the WhichDB Score (39.7/100), and #7 among key-value databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.