Index Pruning

Safely find and drop unused, duplicate and invalid indexes to cut write cost and storage. Candidates come from pg_stat_user_indexes with idx_scan = 0 since the last stats reset, summed across the primary and every replica because statistics are per node; constraint-backing and foreign-key indexes are excluded, exact and prefix duplicates are grouped from pg_index, and invalid indexes left by a failed CREATE INDEX CONCURRENTLY are listed. Wait a full business cycle, record the CREATE statement, then DROP INDEX CONCURRENTLY one at a time under lock_timeout; on MySQL 8 make it INVISIBLE first. Use for "which indexes can we drop", "writes are slow because of too many indexes", "find duplicate indexes". Not for adding the right index (sql-performance), keys for new tables (schema-design), DDL deploy mechanics (db-migration).

greenblacked Updated
The twenty-nine plugins: coding, family, gamedev, operations, delivery, security, manager, personal, career, design, llm, data, techdocs, assurance, client-apps

File contents

greenblacked/AI commit 61a7c94531

Frequently asked questions

npx get-skill add greenblacked/index-pruning