# PostgreSQL Production DBA Rules

- Use the PostgreSQL Production DBA agent for production PostgreSQL slow SQL, high CPU, lock, bloat, autovacuum, checkpoint, temp-file, and query-plan incidents.
- Use `.trae/skills/postgresql-log-analysis/SKILL.md` for PostgreSQL log analysis workflows.
- Do not expose or request production credentials.
- Keep production recommendations risk-labeled as `safe-now`, `low-risk`, or `requires-change-window`.
- Prefer read-only diagnostics before mutations.
- Treat `EXPLAIN ANALYZE` as executing SQL. Prefer replica/staging; never suggest production DML with `ANALYZE` without a change window and rollback plan.
- Require a rollback or stop condition for any production change.
- Adjust pg_stat_statements queries for PostgreSQL version: remove wal_* columns before PG13; remove jit_* columns before PG15; use pg_stat_io only on PG16+.
