Disable Current Of for replicated table (#6407)
* Disable Current Of for replicated table Let's list the plans using CURRENT OF: explain delete from t1 WHERE CURRENT OF c1; QUERY PLAN ----------------------------------------------------------- Delete on t1 (cost=0.00..100.01 rows=1 width=10) -> Tid Scan on t1 (cost=0.00..100.01 rows=1 width=10) Output: ctid, gp_segment_id TID Cond: CURRENT OF c1 Filter: CURRENT OF c1 explain UPDATE r1 SET b = 3 WHERE CURRENT OF c1; QUERY PLAN ----------------------------------------------------------- Update on r1 (cost=0.00..100.01 rows=1 width=18) -> Tid Scan on r1 (cost=0.00..100.01 rows=1 width=18) Output: ctid, gp_segment_id TID Cond: CURRENT OF c1 Filter: CURRENT OF c1 (ctid + gp_segment_id) can identify a unique row for hash distributed table or randomly distributed table, but for replicated table, it can only identify a row in one replica, so in this case other replicas are not updated or deleted properly. There is no proper way to let CURRENT OF work fine for replicated table, so just disable it for now. Updatable view works fine now because all the operations are designed to executed locally, rows of each replica are never flowed to other segments and each replica have the same data flow. For example: create view v_r2 as select * from r2 where c2 = 3; explain update v_r2 set c2 = 4 from p1 where p1.c2=v_r2.c2; QUERY PLAN ----------------------------------------------------------- Update on r2 -> Nested Loop -> Seq Scan on r2 Filter: (c2 = 3) -> Materialize -> Broadcast Motion 3:3 -> Seq Scan on p1 Filter: (c2 = 3) As the plan shows, p1 is broadcasted, so all replicas of replicated table operate locally
Showing
想要评论请 注册 或 登录