3 pages tagged across the site.
In the TTS Study Assistant notes table, queries filter by user_id always and domain often, so the index is declared in that order: CREATE INDEX idx_uid_did ON notes(user_id, domain); A composite index is only fully useful as a left-prefix: this index serves WHERE user_id = ? and WHERE user_id = ? AND domain = ?, but not WHERE domain = ? alone. The rule of thumb is to order columns by how the queries actually filter — most selective / most-always-present first — not by declaration order in the table, and not alphabetically.
B-trees, LSM trees, and the distributed-systems half of how databases are built.
The reference for how storage engines, replication, partitioning, and consensus actually work.