NIP: Postgres slow queries
Alert: NipPostgresSlowQueries · Severity: Warning
What this means
An active query has run >30 seconds.
Fix
docker exec inward_dev-db-1 psql -U $USER -d $DB -c \
"SELECT pid, now()-query_start AS dur, state, left(query,120) FROM pg_stat_activity WHERE state='active' ORDER BY dur DESC LIMIT 10;"
- Identify blocking query — app migration, missing index, lock.
- Do not
pg_terminate_backendwithout app team unless emergency. - Correlate timestamp with transfer slowness.
Escalate if
Multiple slow queries or CBS_SENT stuck rows increasing.