[英]what is partition_position in all_tab_partitions
Anyone can Explain what is partition_position in all_tab_partitions
.任何人都可以解释
all_tab_partitions
中的 partition_position 是什么。
And anyone can tell me what is conversion of this任何人都可以告诉我这是什么转换
SELECT partition_position
FROM all_tab_partitions tp
WHERE tp.table_owner = ? AND
tp.table_name = ? AND
tp.partition_name = ?
to Postgres.到 Postgres。
ALL_TAB_PARTITIONS ALL_TAB_PARTITIONS
Column![]() |
Datatype![]() |
Description![]() |
---|---|---|
PARTITION_POSITION ![]() |
NUMBER![]() |
Position of the partition within the table![]() |
I don't know how (if anyhow ) it can be translated from Oracle to PostgreSQL.我不知道如何(如果无论如何)它可以从 Oracle 转换为 PostgreSQL。
PostgreSQL doesn't have a concept of order in the list of partitions for a table, and indeed it wouldn't make sense in all cases. PostgreSQL 在表的分区列表中没有顺序的概念,实际上并非在所有情况下都有意义。 What if the partitioning key is a data type that doesn't have a total ordering, like
polygon
?如果分区键是没有总排序的数据类型,比如
polygon
怎么办? I admit that that is an unusual data type to partition by, but it could be used with list partitioning.我承认这是一种不常见的分区数据类型,但它可以与列表分区一起使用。
You can convert oracle queries like below (maybe it's not like that but I think it helps you):您可以转换 oracle 查询,如下所示(也许不是那样,但我认为它对您有帮助):
Postgres doesn't have partition_position
column and should create manually based on table object id Postgres 没有
partition_position
列,应根据表 object id 手动创建
WITH partition_info as (
SELECT nmsp_parent.nspname AS parent_schema,
parent.relname AS parent,
owner_parent.rolname AS parent_owner,
nmsp_child.nspname AS child_schema,
child.relname AS child,
owner_child.rolname AS child_owner,
row_number() OVER (PARTITION BY parent.relname ORDER BY child.oid) AS partition_position
FROM pg_inherits
JOIN pg_class parent ON pg_inherits.inhparent = parent.oid
JOIN pg_class child ON pg_inherits.inhrelid = child.oid
JOIN pg_namespace nmsp_parent ON nmsp_parent.oid = parent.relnamespace
JOIN pg_namespace nmsp_child ON nmsp_child.oid = child.relnamespace
JOIN pg_authid owner_parent ON owner_parent.oid = parent.relowner
JOIN pg_authid owner_child ON owner_child.oid = child.relowner
)
SELECT partition_position
FROM partition_info
WHERE child_owner = ? -- table_owner
AND parent = ? -- partition_name
AND child = ? -- table_name
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.