diff options
-rw-r--r-- | src/test/regress/expected/tidscan.out | 83 | ||||
-rw-r--r-- | src/test/regress/sql/tidscan.sql | 2 |
2 files changed, 51 insertions, 34 deletions
diff --git a/src/test/regress/expected/tidscan.out b/src/test/regress/expected/tidscan.out index 521ed1b2f9..bd1fae084a 100644 --- a/src/test/regress/expected/tidscan.out +++ b/src/test/regress/expected/tidscan.out @@ -3,94 +3,108 @@ CREATE TABLE tidscan(id integer); -- only insert a few rows, we don't want to spill onto a second table page INSERT INTO tidscan VALUES (1), (2), (3); -- show ctids +-- XXX since rows come from different datanodes, some TIDs can be duplicated in +-- XL SELECT ctid, * FROM tidscan; ctid | id -------+---- (0,1) | 1 (0,2) | 2 - (0,3) | 3 + (0,1) | 3 (3 rows) -- ctid equality - implemented as tidscan EXPLAIN (COSTS OFF) SELECT ctid, * FROM tidscan WHERE ctid = '(0,1)'; - QUERY PLAN ------------------------------------ - Tid Scan on tidscan - TID Cond: (ctid = '(0,1)'::tid) -(2 rows) + QUERY PLAN +----------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1, datanode_2 + -> Tid Scan on tidscan + TID Cond: (ctid = '(0,1)'::tid) +(4 rows) SELECT ctid, * FROM tidscan WHERE ctid = '(0,1)'; ctid | id -------+---- (0,1) | 1 -(1 row) + (0,1) | 3 +(2 rows) EXPLAIN (COSTS OFF) SELECT ctid, * FROM tidscan WHERE '(0,1)' = ctid; - QUERY PLAN ------------------------------------ - Tid Scan on tidscan - TID Cond: ('(0,1)'::tid = ctid) -(2 rows) + QUERY PLAN +----------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1, datanode_2 + -> Tid Scan on tidscan + TID Cond: ('(0,1)'::tid = ctid) +(4 rows) SELECT ctid, * FROM tidscan WHERE '(0,1)' = ctid; ctid | id -------+---- (0,1) | 1 -(1 row) + (0,1) | 3 +(2 rows) -- ctid = ScalarArrayOp - implemented as tidscan EXPLAIN (COSTS OFF) SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]); - QUERY PLAN -------------------------------------------------------- - Tid Scan on tidscan - TID Cond: (ctid = ANY ('{"(0,1)","(0,2)"}'::tid[])) -(2 rows) + QUERY PLAN +------------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1, datanode_2 + -> Tid Scan on tidscan + TID Cond: (ctid = ANY ('{"(0,1)","(0,2)"}'::tid[])) +(4 rows) SELECT ctid, * FROM tidscan WHERE ctid = ANY(ARRAY['(0,1)', '(0,2)']::tid[]); ctid | id -------+---- (0,1) | 1 (0,2) | 2 -(2 rows) + (0,1) | 3 +(3 rows) -- ctid != ScalarArrayOp - can't be implemented as tidscan EXPLAIN (COSTS OFF) SELECT ctid, * FROM tidscan WHERE ctid != ANY(ARRAY['(0,1)', '(0,2)']::tid[]); - QUERY PLAN ------------------------------------------------------- - Seq Scan on tidscan - Filter: (ctid <> ANY ('{"(0,1)","(0,2)"}'::tid[])) -(2 rows) + QUERY PLAN +------------------------------------------------------------ + Remote Fast Query Execution + Node/s: datanode_1, datanode_2 + -> Seq Scan on tidscan + Filter: (ctid <> ANY ('{"(0,1)","(0,2)"}'::tid[])) +(4 rows) SELECT ctid, * FROM tidscan WHERE ctid != ANY(ARRAY['(0,1)', '(0,2)']::tid[]); ctid | id -------+---- (0,1) | 1 (0,2) | 2 - (0,3) | 3 + (0,1) | 3 (3 rows) -- tid equality extracted from sub-AND clauses EXPLAIN (COSTS OFF) SELECT ctid, * FROM tidscan WHERE (id = 3 AND ctid IN ('(0,2)', '(0,3)')) OR (ctid = '(0,1)' AND id = 1); - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Tid Scan on tidscan - TID Cond: ((ctid = ANY ('{"(0,2)","(0,3)"}'::tid[])) OR (ctid = '(0,1)'::tid)) - Filter: (((id = 3) AND (ctid = ANY ('{"(0,2)","(0,3)"}'::tid[]))) OR ((ctid = '(0,1)'::tid) AND (id = 1))) -(3 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Remote Fast Query Execution + Node/s: datanode_1, datanode_2 + -> Tid Scan on tidscan + TID Cond: ((ctid = ANY ('{"(0,2)","(0,3)"}'::tid[])) OR (ctid = '(0,1)'::tid)) + Filter: (((id = 3) AND (ctid = ANY ('{"(0,2)","(0,3)"}'::tid[]))) OR ((ctid = '(0,1)'::tid) AND (id = 1))) +(5 rows) SELECT ctid, * FROM tidscan WHERE (id = 3 AND ctid IN ('(0,2)', '(0,3)')) OR (ctid = '(0,1)' AND id = 1); ctid | id -------+---- (0,1) | 1 - (0,3) | 3 -(2 rows) +(1 row) -- exercise backward scan and rewind BEGIN; @@ -101,7 +115,8 @@ FETCH ALL FROM c; -------+---- (0,1) | 1 (0,2) | 2 -(2 rows) + (0,1) | 3 +(3 rows) FETCH BACKWARD 1 FROM c; ctid | id diff --git a/src/test/regress/sql/tidscan.sql b/src/test/regress/sql/tidscan.sql index a8472e09ac..c9d632e49d 100644 --- a/src/test/regress/sql/tidscan.sql +++ b/src/test/regress/sql/tidscan.sql @@ -6,6 +6,8 @@ CREATE TABLE tidscan(id integer); INSERT INTO tidscan VALUES (1), (2), (3); -- show ctids +-- XXX since rows come from different datanodes, some TIDs can be duplicated in +-- XL SELECT ctid, * FROM tidscan; -- ctid equality - implemented as tidscan |