pg_database_health
Run health audit (connections utilization, buffer cache hit ratio, dead rows, replication lag).
How to use it
pg_database_health is exposed by the MCP Database Server V2 MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), and the pg_database_health tool becomes available to the model automatically. See the full listing for setup details and every tool this server provides.
Install MCP Database Server V2
claude mcp add --scope user mcp-server-db node /absolute/path/to/mcp-database-server/dist/index.js --env DATABASES_CONFIG_PATH=/absolute/path/to/mcp-database-server/config/databases.config.ymlOther tools in MCP Database Server V2 (39)
Hot-reload databases.config.yml from disk and reconcile connections dynamically without interrupting active queries.
Inspect connection states (idle, connecting, connected, retrying, failed, circuitopen), read-only mode, and error logs across all configured databases.
Retrieve running non-idle queries and durations from pgstatactivity.
Estimate table bloat ratio based on dead tuple count.
Get database name, current user, PostgreSQL version, and database size.
Inspect column data types, ordinal position, and nullability.
Find overlapping or redundant indexes.
Execute write SQL statements (INSERT, UPDATE, DELETE, DDL). Blocked in read-only mode.
Simulate hypothetical index performance using hypopg.
Inspect query execution plans with EXPLAIN.
Get slow queries from pgstatstatements.
Inspect index scan counts and tuple fetch statistics.
Terminate a running backend process by PID. Blocked in read-only mode.
List primary keys, foreign keys, and check constraints.
List user-defined functions, arguments, and return types.
List indexes and index definitions for a table.
List materialized views in a schema.
List all database schemas.
List sequence objects in a schema.
List tables in a target schema.
List triggers and action statements in a schema.
List all views in a schema.
Retrieve active database locks and query durations.
Find queries exceeding a duration threshold.
Identify high-sequential-scan tables needing indexes.
Execute read-only SELECT queries (enforces single-statement extended query protocol).
Refresh a materialized view (supports CONCURRENTLY). Blocked in read-only mode.
Breakdown storage sizes for database, tables, and indexes.
Get total size, table size, index size, and estimated row count.
Identify zero-scan candidate indexes to drop.
Run VACUUM ANALYZE to update statistics and reclaim dead tuples. Blocked in read-only mode.
Delete key. Blocked in read-only mode.
Get string value at key.
Get hash field value.
Set hash field value. Blocked in read-only mode.
List keys matching a glob pattern (capped at 1000 items).
Set multiple key/value pairs in a single command (e.g. for seeding). Blocked in read-only mode.
Set key value. Blocked in read-only mode.
Get remaining TTL in seconds.