PolarDB-X provides three ways to inspect partitioned tables: query partition metadata, locate the physical position of each partition, and view data distribution statistics. Choose the method that fits your task.
| Method | Best for |
|---|---|
INFORMATION_SCHEMA.PARTITIONS | Inspecting partition and subpartition metadata (method, expression, boundary values) |
SHOW TOPOLOGY | Finding which data node hosts each physical table |
INFORMATION_SCHEMA.TABLE_DETAIL | Checking data distribution percentages and read/write statistics per partition |
Use the PARTITIONS view
INFORMATION_SCHEMA.PARTITIONS queries the metadata of each partition and its subpartitions. PolarDB-X is compatible with the MySQL INFORMATION_SCHEMA.PARTITIONS view.
Because the view has 26 columns, use \G for vertical output or select only the columns you need.
Example: query specific columns
SELECT
PARTITION_NAME,
SUBPARTITION_NAME,
PARTITION_ORDINAL_POSITION,
SUBPARTITION_ORDINAL_POSITION,
PARTITION_METHOD,
SUBPARTITION_METHOD,
PARTITION_EXPRESSION,
SUBPARTITION_EXPRESSION,
PARTITION_DESCRIPTION,
SUBPARTITION_DESCRIPTION,
DATA_LENGTH
FROM information_schema.partitions
WHERE table_schema = 'autodb2'
AND table_name = 'test_tbl_part_name2'
ORDER BY PARTITION_NAME, SUBPARTITION_NAME;Example output:
+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+--------------------------+-------------+
| PARTITION_NAME | SUBPARTITION_NAME | PARTITION_ORDINAL_POSITION | SUBPARTITION_ORDINAL_POSITION | PARTITION_METHOD | SUBPARTITION_METHOD | PARTITION_EXPRESSION | SUBPARTITION_EXPRESSION | PARTITION_DESCRIPTION | SUBPARTITION_DESCRIPTION | DATA_LENGTH |
+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+--------------------------+-------------+
| p1 | p1sp1 | 1 | 1 | KEY | KEY | bid | id | 1 | -4611686018427387899 | 16384 |
| p1 | p1sp2 | 1 | 2 | KEY | KEY | bid | id | 1 | 3 | 16384 |
| p1 | p1sp3 | 1 | 3 | KEY | KEY | bid | id | 1 | 4611686018427387905 | 16384 |
| p1 | p1sp4 | 1 | 4 | KEY | KEY | bid | id | 1 | 9223372036854775807 | 16384 |
| p2 | p2sp1 | 2 | 1 | KEY | KEY | bid | id | 9223372036854775807 | -4611686018427387899 | 16384 |
| p2 | p2sp2 | 2 | 2 | KEY | KEY | bid | id | 9223372036854775807 | 3 | 16384 |
| p2 | p2sp3 | 2 | 3 | KEY | KEY | bid | id | 9223372036854775807 | 4611686018427387905 | 16384 |
| p2 | p2sp4 | 2 | 4 | KEY | KEY | bid | id | 9223372036854775807 | 9223372036854775807 | 16384 |
+----------------+-------------------+----------------------------+-------------------------------+------------------+---------------------+----------------------+-------------------------+-----------------------+--------------------------+-------------+
8 rows in set (0.14 sec)To see all 26 columns, run SELECT * FROM information_schema.partitions WHERE ... \G.
Use the SHOW TOPOLOGY statement
Run SHOW TOPOLOGY FROM <table_name> to see which data node hosts each physical table. This is useful for verifying the physical distribution of partitions across storage nodes.
Example:
SHOW TOPOLOGY FROM test_tbl_part_name2
ORDER BY PARTITION_NAME, SUBPARTITION_NAME;Example output:
+------+----------------------+--------------------------------+----------------+-------------------+----------------+---------------------------+
| ID | GROUP_NAME | TABLE_NAME | PARTITION_NAME | SUBPARTITION_NAME | PHY_DB_NAME | DN_ID |
+------+----------------------+--------------------------------+----------------+-------------------+----------------+---------------------------+
| 4 | AUTODB2_P00000_GROUP | test_tbl_part_name2_xds7_00000 | p1 | p1sp1 | autodb2_p00000 | polardbx-storage-0-master |
| 0 | AUTODB2_P00001_GROUP | test_tbl_part_name2_xds7_00001 | p1 | p1sp2 | autodb2_p00001 | polardbx-storage-1-master |
| 5 | AUTODB2_P00000_GROUP | test_tbl_part_name2_xds7_00002 | p1 | p1sp3 | autodb2_p00000 | polardbx-storage-0-master |
| 1 | AUTODB2_P00001_GROUP | test_tbl_part_name2_xds7_00003 | p1 | p1sp4 | autodb2_p00001 | polardbx-storage-1-master |
| 6 | AUTODB2_P00000_GROUP | test_tbl_part_name2_xds7_00004 | p2 | p2sp1 | autodb2_p00000 | polardbx-storage-0-master |
| 2 | AUTODB2_P00001_GROUP | test_tbl_part_name2_xds7_00005 | p2 | p2sp2 | autodb2_p00001 | polardbx-storage-1-master |
| 7 | AUTODB2_P00000_GROUP | test_tbl_part_name2_xds7_00006 | p2 | p2sp3 | autodb2_p00000 | polardbx-storage-0-master |
| 3 | AUTODB2_P00001_GROUP | test_tbl_part_name2_xds7_00007 | p2 | p2sp4 | autodb2_p00001 | polardbx-storage-1-master |
+------+----------------------+--------------------------------+----------------+-------------------+----------------+---------------------------+
8 rows in set (0.07 sec)Output fields:
| Field | Description |
|---|---|
ID | Row identifier |
GROUP_NAME | Internal shard group that manages the physical table |
TABLE_NAME | Name of the physical table on the data node |
PARTITION_NAME | Logical partition name |
SUBPARTITION_NAME | Logical subpartition name |
PHY_DB_NAME | Physical database name on the data node |
DN_ID | Data node (DN) identifier — the storage node that holds this partition |
Use the TABLE_DETAIL view
INFORMATION_SCHEMA.TABLE_DETAIL shows how data is distributed across partitions and how much read/write activity each partition has seen. This view also exposes PolarDB-X-specific metadata, such as the table group a partitioned table belongs to and the global index table it is associated with.
Example:
SELECT
table_name,
partition_name,
subpartition_name,
percent,
rows_read,
rows_inserted,
rows_updated,
rows_deleted
FROM information_schema.table_detail
WHERE table_schema = 'autodb2'
AND table_name = 'test_tbl_part_name2'
ORDER BY partition_name, subpartition_name;Example output:
+---------------------+----------------+-------------------+--------------------------------------+-----------+---------------+--------------+--------------+
| table_name | partition_name | subpartition_name | percent | rows_read | rows_inserted | rows_updated | rows_deleted |
+---------------------+----------------+-------------------+--------------------------------------+-----------+---------------+--------------+--------------+
| test_tbl_part_name2 | p1 | p1sp1 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p1 | p1sp2 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p1 | p1sp3 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p1 | p1sp4 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p2 | p2sp1 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p2 | p2sp2 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p2 | p2sp3 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
| test_tbl_part_name2 | p2 | p2sp4 | 0.00%├-------------------------┤ | 0 | 0 | 0 | 0 |
+---------------------+----------------+-------------------+--------------------------------------+-----------+---------------+--------------+--------------+
8 rows in set (0.10 sec)The percent column shows each partition's share of the total table data as a progress bar. The rows_read, rows_inserted, rows_updated, and rows_deleted columns reflect read and write activity per partition.