Database statistics
pg_database_statsInspect PostgreSQL database statistics to assess usage patterns and detect deadlocks, temp-file spills, and high rollback ratios.
Instructions
Show pg_stat_database for the current database (or every database with
all_databases=true): connections, commits and rollbacks with the rollback ratio,
blocks read and hit with the cache hit ratio, rows returned, fetched, inserted, updated
and deleted, recovery conflicts, temporary files, deadlocks, I/O times, checksum
failures (PostgreSQL 12+), session counts and times (14+) and when the statistics were
last reset.
Counters accumulate since the reset. Use it for a first look at how a database is used and to spot deadlocks, temp-file spills and a high rollback ratio.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "pg_database_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection | No | ||
| all_databases | No |