Disallow the replicated table inherit or to be inherited(#10428)
Currently, replicated tables are not allowed to inherit a parent table. But ALTER TABLE .. INHERIT can pass around the restriction. On the other hand, a replicated table is allowed to be inherited by a hash distributed table. It makes things much complicated. When the parent table is declared as a replicated table inherited by a hash distributed table, its data on the parent is replicated but the data on the child is hash distributed. When running `select * from parent;`, the generated plan is: ``` gpadmin=# explain select * from parent; QUERY PLAN ----------------------------------------------------------------------------- Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..4.42 rows=14 width=6) -> Append (cost=0.00..4.14 rows=5 width=6) -> Result (cost=0.00..1.20 rows=4 width=7) One-Time Filter: (gp_execution_segment() = 1) -> Seq Scan on parent (cost=0.00..1.10 rows=4 width=7) -> Seq Scan on child (cost=0.00..3.04 rows=2 width=4) Optimizer: Postgres query optimizer (7 rows) ``` It's not particularly useful for the parent table to be replicated. So, we disallow the replicated table to be inherited. Reported-by: NHeikki Linnakangas <hlinnakangas@pivotal.io> Reviewed-by: NHubert Zhang <hzhang@pivotal.io> (cherry picked from commit dc4b839e)
Showing
想要评论请 注册 或 登录