All Products
Search
Document Center

PolarDB:Partitioned table views

Last Updated:Mar 28, 2026

PolarDB for PostgreSQL(Compatible with Oracle) provides five system catalog views for querying partition and subpartition metadata.

ViewScope
ALL_PART_TABLESPartitioned tables accessible in the current database
ALL_TAB_PARTITIONSPartitions in the current database
ALL_TAB_SUBPARTITIONSSubpartitions in the current database
ALL_PART_KEY_COLUMNSPartition key columns in the current database
ALL_SUBPART_KEY_COLUMNSSubpartition key columns in the current database

Query a view

Use either of the following methods to query these views. Replace <viewname> with the actual view name.

SQL

SELECT * FROM <viewname>;

For example, to list all partitioned tables with their partition type and count:

SELECT owner, table_name, partitioning_type, partition_count FROM ALL_PART_TABLES;

psql

\d <viewname>

ALL_PART_TABLES

ALL_PART_TABLES returns one row per partitioned table accessible in the current database.

ColumnTypeDescription
ownerTEXTOwner of the partitioned table.
schema_nameTEXTSchema that contains the table.
table_nameTEXTName of the table.
partitioning_typeTEXTThe partition type used to define table partitions.
subpartitioning_typeTEXTThe subpartition type used to define table subpartitions.
partition_countBIGINTNumber of partitions.
def_subpartition_countINTEGERThe number of subpartitions in the table.
partitioning_key_countINTEGERNumber of partition key columns.
subpartitioning_key_countINTEGERNumber of subpartition key columns.
statusCHARACTER VARYING(8)Included for compatibility only. Always VALID.
def_tablespace_nameCHARACTER VARYING(30)Included for compatibility only. Always NULL.
def_pct_freeNUMERICIncluded for compatibility only. Always NULL.
def_pct_usedNUMERICIncluded for compatibility only. Always NULL.
def_ini_transNUMERICIncluded for compatibility only. Always NULL.
def_max_transNUMERICIncluded for compatibility only. Always NULL.
def_initial_extentCHARACTER VARYING(40)Included for compatibility only. Always NULL.
def_next_extentCHARACTER VARYING(40)Included for compatibility only. Always NULL.
def_min_extentsCHARACTER VARYING(40)Included for compatibility only. Always NULL.
def_max_extentsCHARACTER VARYING(40)Included for compatibility only. Always NULL.
def_pct_increaseCHARACTER VARYING(40)Included for compatibility only. Always NULL.
def_freelistsNUMERICIncluded for compatibility only. Always NULL.
def_freelist_groupsNUMERICIncluded for compatibility only. Always NULL.
def_loggingCHARACTER VARYING(7)Included for compatibility only. Always YES.
def_compressionCHARACTER VARYING(8)Included for compatibility only. Always NONE.
def_buffer_poolCHARACTER VARYING(7)Included for compatibility only. Always DEFAULT.
ref_ptn_constraint_nameCHARACTER VARYING(30)Included for compatibility only. Always NULL.
intervalCHARACTER VARYING(1000)Included for compatibility only. Always NULL.

ALL_TAB_PARTITIONS

ALL_TAB_PARTITIONS returns one row per partition in the current database.

ColumnTypeDescription
table_ownerTEXTOwner of the table.
schema_nameTEXTSchema that contains the table.
table_nameTEXTName of the table.
compositeTEXTWhether the table has subpartitions. YES: the table is subpartitioned. NO: the table is not subpartitioned.
partition_nameTEXTName of the partition.
subpartition_countBIGINTNumber of subpartitions in this partition.
high_valueTEXTThe high partitioning value specified in the CREATE TABLE statement.
high_value_lengthINTEGERLength of high_value.
partition_positionINTEGERIncluded for compatibility only. Always NULL.
tablespace_nameTEXTTablespace that contains the partition.
pct_freeNUMERICIncluded for compatibility only. Always 0.
pct_usedNUMERICIncluded for compatibility only. Always 0.
ini_transNUMERICIncluded for compatibility only. Always 0.
max_transNUMERICIncluded for compatibility only. Always 0.
initial_extentNUMERICIncluded for compatibility only. Always NULL.
next_extentNUMERICIncluded for compatibility only. Always NULL.
min_extentNUMERICIncluded for compatibility only. Always 0.
max_extentNUMERICIncluded for compatibility only. Always 0.
pct_increaseNUMERICIncluded for compatibility only. Always 0.
freelistsNUMERICIncluded for compatibility only. Always NULL.
freelist_groupsNUMERICIncluded for compatibility only. Always NULL.
loggingCHARACTER VARYING(7)Included for compatibility only. Always YES.
compressionCHARACTER VARYING(8)Included for compatibility only. Always NONE.
num_rowsNUMERICEstimated row count. Same as pg_class.reltuples.
blocksINTEGERNumber of disk pages. Same as pg_class.relpages.
empty_blocksNUMERICIncluded for compatibility only. Always NULL.
avg_spaceNUMERICIncluded for compatibility only. Always NULL.
chain_cntNUMERICIncluded for compatibility only. Always NULL.
avg_row_lenNUMERICIncluded for compatibility only. Always NULL.
sample_sizeNUMERICIncluded for compatibility only. Always NULL.
last_analyzedTIMESTAMP WITHOUT TIME ZONEIncluded for compatibility only. Always NULL.
buffer_poolCHARACTER VARYING(7)Included for compatibility only. Always NULL.
global_statsCHARACTER VARYING(3)Included for compatibility only. Always YES.
user_statsCHARACTER VARYING(3)Included for compatibility only. Always NO.
backing_tableREGCLASSName of the partition's backing table.

ALL_TAB_SUBPARTITIONS

ALL_TAB_SUBPARTITIONS returns one row per subpartition in the current database.

ColumnTypeDescription
table_ownerTEXTOwner of the table.
schema_nameTEXTSchema that contains the table.
table_nameTEXTName of the table.
partition_nameTEXTName of the parent partition.
subpartition_nameTEXTName of the subpartition.
high_valueTEXTThe high subpartitioning value specified in the CREATE TABLE statement.
high_value_lengthINTEGERLength of high_value.
subpartition_positionINTEGERIncluded for compatibility only. Always NULL.
tablespace_nameTEXTTablespace that contains the subpartition.
pct_freeNUMERICIncluded for compatibility only. Always 0.
pct_usedNUMERICIncluded for compatibility only. Always 0.
ini_transNUMERICIncluded for compatibility only. Always 0.
max_transNUMERICIncluded for compatibility only. Always 0.
initial_extentNUMERICIncluded for compatibility only. Always NULL.
next_extentNUMERICIncluded for compatibility only. Always NULL.
min_extentNUMERICIncluded for compatibility only. Always 0.
max_extentNUMERICIncluded for compatibility only. Always 0.
pct_increaseNUMERICIncluded for compatibility only. Always 0.
freelistsNUMERICIncluded for compatibility only. Always NULL.
freelist_groupsNUMERICIncluded for compatibility only. Always NULL.
loggingCHARACTER VARYING(7)Included for compatibility only. Always YES.
compressionCHARACTER VARYING(8)Included for compatibility only. Always NONE.
num_rowsNUMERICEstimated row count. Same as pg_class.reltuples.
blocksINTEGERNumber of disk pages. Same as pg_class.relpages.
empty_blocksNUMERICIncluded for compatibility only. Always NULL.
avg_spaceNUMERICIncluded for compatibility only. Always NULL.
chain_cntNUMERICIncluded for compatibility only. Always NULL.
avg_row_lenNUMERICIncluded for compatibility only. Always NULL.
sample_sizeNUMERICIncluded for compatibility only. Always NULL.
last_analyzedTIMESTAMP WITHOUT TIME ZONEIncluded for compatibility only. Always NULL.
buffer_poolCHARACTER VARYING(7)Included for compatibility only. Always NULL.
global_statsCHARACTER VARYING(3)Included for compatibility only. Always YES.
user_statsCHARACTER VARYING(3)Included for compatibility only. Always NO.
backing_tableREGCLASSName of the subpartition's backing table.

ALL_PART_KEY_COLUMNS

ALL_PART_KEY_COLUMNS returns one row per partition key column in the current database.

ColumnTypeDescription
ownerTEXTOwner of the partitioned table.
schema_nameTEXTSchema that contains the table.
nameTEXTName of the partitioned table.
object_typeCHARACTER(5)Included for compatibility only. Always TABLE.
column_nameTEXTName of the partition key column.
column_positionINTEGEROrdinal position of the column in the partition key. 1 = first key column, 2 = second key column, and so on.

ALL_SUBPART_KEY_COLUMNS

ALL_SUBPART_KEY_COLUMNS returns one row per subpartition key column in the current database.

ColumnTypeDescription
ownerTEXTOwner of the partitioned table.
schema_nameTEXTSchema that contains the table.
nameTEXTName of the partitioned table.
object_typeCHARACTER(5)Included for compatibility only. Always TABLE.
column_nameTEXTName of the subpartition key column.
column_positionINTEGEROrdinal position of the column in the subpartition key. 1 = first key column, 2 = second key column, and so on.