db-indexing
Installation
SKILL.md
db-indexing (M11)
Indexing is the single heaviest Performance & Scale (axis performance) lever (relational weight
20, Indexación). This module checks whether the indexes that exist match how the data is queried —
missing, mis-ordered, or wrong-type indexes turn a sub-millisecond lookup into a sequential scan.
What it checks
- Composite order (ESR) — multi-column indexes should order columns Equality → Sort → Range. A leading range/low-selectivity column wastes the index.
- Covering / partial — frequent
SELECT a,b WHERE cbenefits from anINCLUDEcovering index; queries always filtered on a predicate (WHERE deleted_at IS NULL) benefit from a partial index. - Specialized types —
GINforjsonb/array/FTS containment,GiST/SP-GiSTfor geometry/range,BRINfor naturally-ordered append-only columns (timestamps). Flag full-text/geo/JSONB filters served by a plain B-tree (or no index). - FK-no-index — every foreign key column should have a covering index; an unindexed FK forces a
sequential scan on the referenced side during
ON DELETE/ON UPDATEand on joins. This is the highest-yield, lowest-risk index finding.