table_stats
Retrieve read-only approximate row counts and disk/index sizes per table, largest first, to plan migration copy order and spot anomalies without table scans.
Instructions
Approximate row counts and disk/index sizes per table, largest first.
Read-only. Uses the database's own statistics — fast, no table scans — so counts
are as fresh as the last ANALYZE or autovacuum run; for an exact count run
SELECT count(*) with execute_read_query. Useful for planning migration copy
order and spotting anomalies; for columns and keys use get_table_schema. One row
per table, so ask the narrower question instead of filtering afterwards: table
for one table, min_size_bytes to skip anything smaller, limit for the top N.
Returns meta, database and tables, one item per table with schema,
table, approx_rows, table_bytes, index_bytes and total_bytes, plus
truncated when limit is set (true when more tables matched); meta.truncated
repeats it, and is false without limit.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"database": "<database>"
},
"name": "table_stats"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Return only the N largest tables by total size. Omit for all. | |
| table | No | Only this table, exactly as list_tables shows it, optionally schema-qualified ('public.orders'). Omit for every table. | |
| database | Yes | Name of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names. | |
| min_size_bytes | No | Skip tables whose total size is below this many bytes. |