Table statistics
pg_table_statsInspect per-table PostgreSQL activity to identify sequential-scan-heavy tables, dead-row buildup, and tables missed by autovacuum; filter by schema/table and rank by scans, changes, size, or cache hit.
Instructions
Show per-table activity from pg_stat_user_tables: sequential and index scans, rows inserted, updated (and HOT updated) and deleted, live and dead rows, rows changed since the last analyze, last vacuum/autovacuum/analyze/autoanalyze and the cache hit ratio.
Use it to find tables read by sequential scans, tables full of dead rows and tables
that autovacuum has not touched. Filter with schema and table (name, schema.name,
or a pattern with *). order_by picks the ranking; cache_hit lists the worst first.
Counters accumulate since the statistics were reset (shown as counters_since).
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_table_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| table | No | ||
| schema | No | ||
| order_by | No | seq_scan | |
| connection | No |