Updated on 2025-05-29 GMT+08:00

Collecting Statistics on Partitioned Tables

For partitioned tables, you can collect partition-level statistics, which can be queried in the pg_partition and pg_statistic system catalogs and in the pg_stats and pg_ext_stats views.

Partition-level statistics apply to the scenario where the scan range is reduced to a single partition after static pruning is performed on a partitioned table. The following statistics can be collected: number of pages and tuples at the partition level, single-column statistics, multi-column statistics, and expression index statistics.

You can collect statistics on partitioned tables in either of the following ways:

  • Collect statistics in cascading mode.
  • Collect statistics on a specified partition.