如何检索分区边界
How to retrieve partitioning boundaries
我有 postgres 10+。假设我创建了一个声明性分区 table by RANGE 和多个分区。
如何检索特定分区的边界?
边界存储在分区的 pg_class
条目的 relpartbound
列中。此查询打印所有分区的名称及其分区边界:
SELECT t.oid::regclass AS partition,
pg_get_expr(t.relpartbound, t.oid) AS bounds
FROM pg_inherits AS i
JOIN pg_class AS t ON t.oid = i.inhrelid
WHERE i.inhparent = 'partitioned_table'::regclass;
我有 postgres 10+。假设我创建了一个声明性分区 table by RANGE 和多个分区。
如何检索特定分区的边界?
边界存储在分区的 pg_class
条目的 relpartbound
列中。此查询打印所有分区的名称及其分区边界:
SELECT t.oid::regclass AS partition,
pg_get_expr(t.relpartbound, t.oid) AS bounds
FROM pg_inherits AS i
JOIN pg_class AS t ON t.oid = i.inhrelid
WHERE i.inhparent = 'partitioned_table'::regclass;