On this page
  1. Indexing & Storage Engines
  2. Contents
  3. B-Tree vs. LSM-Tree Storage Engines
  4. Composite Indexes & the Leftmost-Prefix Rule
  5. Covering, Partial & Expression Indexes

Indexing & Storage Engines

Prev: Normalization & Data Modeling | Up: design_patterns | Next: Transactions, ACID & Isolation Levels
Rel: SQL Query Execution Lifecycle, PostgreSQL Indexes & EXPLAIN ANALYZE, MongoDB Indexes
Ref: SQLite — Query Planning & Indexes
Tags: #public #databases #design-patterns #indexing


Contents


B-Tree vs. LSM-Tree Storage Engines

Engine Used By Strengths Trade-offs
B-Tree / B+Tree PostgreSQL, SQLite, InnoDB Fast point & range reads, predictable latency Random in-place page writes
LSM-Tree RocksDB, Cassandra, Pebble High sequential write throughput (memtable + SSTables) Read amplification & background compaction

Composite Indexes & the Leftmost-Prefix Rule

An index on (a, b, c) accelerates lookups on (a), (a, b), and (a, b, c) — not (b, c) alone. Put equality columns before range columns (WHERE status = 'paid' AND created_at >= ... -> index (status, created_at)).


Covering, Partial & Expression Indexes

Linked from

Related notes