listPartitions

Return every partitioned table in a schema with its partitioning strategy (range/list/hash), the partition key, how many partitions it has, the combined estimated row count and size of every leaf partition at any depth (a sub-partitioned child holds nothing itself), whether a…

read-onlyany connectionsweeps instancesweeps group

Synopsis

listPartitions(schema)

Description

Return every partitioned table in a schema with its partitioning strategy (range/list/hash), the partition key, how many partitions it has, the combined estimated row count and size of every leaf partition at any depth (a sub-partitioned child holds nothing itself), whether a DEFAULT partition exists and how many rows it holds, and how many partitions are themselves partitioned. rows and size_estimate cover only the leaves that have been analyzed, and never_analyzed says how many leaf_partitions they could not see; both are null when no leaf has been measured. default_rows is null, not 0, when the default partition has never been analyzed: reltuples stays -1 until then even after rows arrive, and has_default says whether a default exists at all.

Reads reltuples and relpages from the catalog, so no relation is opened and no lock is taken -- for measured sizes call listTableSizes on the schema the partitions live in. A growing default partition is the finding to look for: rows land there when they match no bound, so it is a missing partition that has not failed loudly yet. Name a parent to partitionDetails for the per-partition bounds and vacuum state.

Parameters

schema requiredstring

Also accepts connection, instance, group, described once under arguments every tool takes.

Output

Keyed by partitioned table name; each value is its strategy, key, partition count and default partition. An absent extension or a missing grant is reported as {error, hint} in place of the map.

Scope

A physical replica is byte-identical here, so asking each member of a replication group adds nothing.

Example mocked data

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "listPartitions",
    "arguments": {
      "schema": "shop"
    }
  }
}

Result

{
  "events": {
    "strategy": "range",
    "key": "RANGE (created_at)",
    "partitions": 13,
    "has_default": true,
    "default_partition": "events_default",
    "default_rows": 412,
    "leaf_partitions": 13,
    "never_analyzed": 1,
    "rows": 88210442,
    "size_estimate": 14203342848,
    "sub_partitioned": 0
  }
}

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.

See also

listSchemas, listTables, tableDetails, tableStats, largeObjects, partitionDetails, listTableStats, tableSize, listTableSizes, listFunctions, functionDetails, listEnums, enumDetails, listTypes, typeDetails, columnHistogram, listExtendedStatistics, listSequences