Database Health
db_healthChecks database connectivity, pool stats, uptime, and PostgreSQL system health to verify responsiveness and diagnose performance issues.
Instructions
Checks database connectivity, connection pool statistics, server uptime, and total request count. In multi-database mode, omit the database parameter to see health status for all configured databases simultaneously. Also runs PostgreSQL system checks: vacuum health (TXID wraparound risk), replication lag, index usage, sequence exhaustion, buffer cache hit rate, and invalid constraints.
When to use:
At the start of a session to verify the database is responsive.
When the user asks about connection health or pool utilization.
When troubleshooting slow responses or connection errors.
Periodically during long sessions to check pool exhaustion.
To check vacuum/replication/sequence health in production.
Behavioral notes:
In single-database mode, returns stats for the one connected database.
In multi-database mode, returns an array of health entries for all databases.
'idle' connections are available; 'active' connections are in use.
If pool utilization is high (>80%), consider increasing PGPOOL_MAX.
Vacuum checks query pg_stat_user_tables — no extensions required.
Replication checks query pg_stat_replication — returns empty on standalone instances.
Buffer cache checks pg_stat_database for hit rate below 90%.
Constraint checks pg_constraint for invalid (unvalidated) constraints.
Returns: JSON with connected (boolean), pool stats (total, idle, active), uptime seconds, total requests served, database connection summary, and health checks (vacuum, replication, indexes, sequences, bufferCache, constraints).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Name of the database to query (from pgautopilot.json). Omit to use the current default database. |