← ClaudeAtlas

db-tweaklisted

PostgreSQL database tuning — slow query optimization / index design / 9 iron laws / 7 phases / 8 patterns / retirement pipeline (PLAN_DELETE_ rename). Includes plan-delete.sh, audit-plan-delete.sh, config_drift.py. Triggers: PostgreSQL, PG, index, EXPLAIN, VACUUM, slow query, DROP, schema, tuning, plan-delete, migration, database tune, query optimization, bloat
ebziw/repo-medic · ★ 0 · API & Backend · score 75
Install: claude install-skill ebziw/repo-medic
# db-tweak — PostgreSQL Tuning Self-contained skill. Covers PG slow query optimization, indexes, DDL safety, and the retirement pipeline for column/table deletion. ## 🛑 MANDATORY WORKFLOW — check all before declaring done ### Phase 0: Baseline (evidence first — iron law 1) - [ ] **Read** `references/db-tuning.md` in full (9 iron laws + 7 phases + 8 patterns) - [ ] **Capture top 20 slow queries**: `SELECT * FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 20;` - [ ] **Table size + index bloat snapshot**: quantify with `pgstattuple`, save as `baseline-<date>.json` - [ ] **EXPLAIN ANALYZE** the current slow queries (with the BUFFERS option) and save a before/after comparison baseline - [ ] 🛑 **GATE**: enter Phase 1 only after the baseline document is on disk (`baseline-<date>.json`) ### Phase 1: 9 iron laws pre-check (run through all of iron laws 1-9) - [ ] **Iron law 1**: run `EXPLAIN (ANALYZE, BUFFERS)` on every slow query before any change - [ ] **Iron law 2**: does the upcoming DDL use CONCURRENTLY? - [ ] **Iron law 3**: all 3 checks done for the DROP candidate — references / backup / RENAME window? - [ ] **Iron law 4**: identifiers all lowercase with underscores? No PG reserved words? - [ ] **Iron law 5**: `SET statement_timeout = '30s'` set on every session? - [ ] **Iron law 6**: about to run VACUUM FULL? owner approved? - [ ] **Iron law 7**: lock waits currently > 5s? checked `pg_stat_activity`? - [ ] **Iron law 8**: DDL via migration tool (no bare `psql