Measure every table in a schema on disk: table size, index size and grand total per relation.
read-onlyany connectionsweeps instancesweeps group
listTableSizes(schema)
Measure every table in a schema on disk: table size, index size and grand total per relation. COSTS MORE THAN IT LOOKS, and more here than in tableSize: one relation is opened per table, each taking AccessShareLock, so a single table held under AccessExclusiveLock by an ALTER TABLE blocks the whole call rather than one row of it, and on a large schema this is thousands of file-metadata calls. Prefer size_estimate from listTableStats, which is free, and call this when the estimates are too stale to act on.
Partitioned tables report their own storage, which is zero; listPartitions summarises them and partitionDetails names their partitions.
Also accepts connection, instance, group, described once under arguments every tool takes.
Keyed by table name; each value is that table's measured size, index size and total. An absent extension or a missing grant is reported as {error, hint} in place of the map.
A physical replica is byte-identical here, so asking each member of a replication group adds nothing.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "listTableSizes",
"arguments": {
"schema": "shop"
}
}
}
{
"orders": {
"kind": "table",
"size": 192848896,
"indexes_size": 60489728,
"total_size": 253338624
},
"customers": {
"kind": "table",
"size": 14032896,
"indexes_size": 5226496,
"total_size": 19259392
}
}
Invented values on a fictional shop database, shaped by and checked against this tool's output schema. Real output is returned as structuredContent to clients that negotiate MCP 2025-06-18 or later.
listSchemas, listTables, tableDetails, tableStats, largeObjects, listPartitions, partitionDetails, listTableStats, tableSize, listFunctions, functionDetails, listEnums, enumDetails, listTypes, typeDetails, columnHistogram, listExtendedStatistics, listSequences