Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Postgres Performance?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-postgres-performance)
---
description: Tune PostgreSQL throughput and stability via pooling, vacuum tuning, partitioning, and pg_stat_statements
profile: standard
tags: database, postgres, performance, operations
---
# Postgres performance
Use when diagnosing PostgreSQL CPU/I/O bottlenecks, connection saturation, table bloat, or scaling growth.
## Connections and memory
- Place PgBouncer in `transaction` pooling mode in front of serverless or high-concurrency apps; keep `max_connections` conservative and reserve superuser slots.
- Avoid setting `work_mem` high globally (`max_connections * work_mem * active sorts` can OOM); raise it per-session or per-query when needed.
- Inspect `pg_stat_statements` sorted by `total_exec_time` and `shared_blks_read` before touching server flags.
## Maintenance and scaling
- Watch dead tuple ratios (`n_dead_tup`) on hot update/delete tables; lower per-table `autovacuum_vacuum_scale_factor` (e.g., `0.02`) instead of relying solely on default 20% thresholds on multi-million-row tables.
- Partition high-volume append tables (events, logs, telemetry) by time so retention drops partitions cleanly instead of creating vacuum storms.
- Tune `random_page_cost` for SSD storage (`~1.1`) so the planner prefers index scans appropriately.
## Verify
Check `pg_stat_statements`, `pg_stat_user_tables` bloat/vacuum lag, and `EXPLAIN (ANALYZE, BUFFERS)` before and after tuning.