databases
9 minMySQL InnoDB: Transactions, Indexes, and Reading EXPLAIN
Understand InnoDB's clustered primary key, secondary-index lookups, transaction behavior, and practical query-plan analysis.
Loading page...
databases
9 minUnderstand InnoDB's clustered primary key, secondary-index lookups, transaction behavior, and practical query-plan analysis.
databases
8 minUse concurrent index builds without assuming they are lock-free or all-or-nothing.
Q&A
Q&AInnoDB secondary-index entries carry the primary-key value used to find the clustered row.
InnoDB organizes table rows by the clustered primary key. Secondary indexes store their indexed columns plus the primary-key value, so a query requesting columns absent from the secondary index may need a second lookup. Wide primary keys therefore increase the footprint of every secondary index.
databases
10 minConnect PostgreSQL's multi-version concurrency control to transaction visibility, vacuum work, index choice, and EXPLAIN output.
databases
10 minA systematic approach to diagnosing ORM query explosions and slow database plans without guessing at indexes.
Q&A
Q&ACheck active work and catalog validity before dropping or retrying.
Concurrent builds use multiple phases and can leave an invalid index. Inspect the server error and pg_index readiness/validity, waits, and transactions; do not assume the operation was atomic or load-free.
databases
19 minReason about isolation anomalies, query-plan mistakes, B-tree/LSM trade-offs, shard routing, and production-safe index changes.
Q&A
Q&AUsually the leading-column prefix matters; validate any skip-scan behavior on the target engine.
A composite B-tree is generally organized by its leading column, so omitting a can prevent efficient use of the index for b/c-only predicates. Some engines and versions may use skip scans under particular statistics, but do not assume it. Compare a candidate (b, c) index with the existing index using representative plans and write-cost measurements.