⚡AgentSkills
⚙️ Backend Engineering · Databases

Optimize the slow queries actually hurting you

Find top offenders from real traffic, read plans, add targeted indexes, verify improvements.

intermediate~35 minBackend EngineersAPI DevelopersPlatform Engineers

Steps

  1. 1Pull top-10 queries by total time from pg_stat_statements or slow log
  2. 2Read EXPLAIN (ANALYZE) for each; find seq scans on growing tables
  3. 3Index to match predicates AND sorts (composite order matters)
  4. 4Cover hot read paths with covering indexes where sensible
  5. 5Re-measure p95 after deploy; drop indexes that nobody uses
  6. 6Guard CI against new seq-scan regressions on core tables

Common Pitfalls

  • ▲Indexing every column 'just in case', tanking write throughput
  • ▲Functions wrapping indexed columns, silently disabling them

Commands

Install with skills CLI
$ npx skills add aniruddhaadak80/skills --skill databases-query-optimization
Install globally
$ npx skills add aniruddhaadak80/skills --skill databases-query-optimization -g

Tags

#performance#sql#indexes#backend-engineering#databases

Related skills

Normalize enough to stay consistent, denormalize deliberately where reads demand it.

⚙️ Backend Engineering·~35m

Normalize enough to stay consistent, denormalize deliberately where reads demand it.

⚙️ Backend Engineering·~35m

Normalize enough to stay consistent, denormalize deliberately where reads demand it.

⚙️ Backend Engineering·~35m