mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 03:23:37 +08:00
Mark hypertable parent as dummy rel for UPDATE
When postgres expands an inheritance tree it also adds the parent hypertable as child relation. Since for a hypertable the parent will never have any data we can mark this relation as dummy relation so it gets ignored in later steps. This is only relevant for code paths that use the postgres inheritance code as we don't include the hypertable as child when expanding the hypertable ourself. This is similar to 3c40f924 which did the same adjustment for DELETE. This patch also moves the marking into get_relation_info_hook so it happens a bit earlier and prevents some additional cycles.
This commit is contained in:
parent
6d40c30d10
commit
fca865ced9
@ -127,7 +127,7 @@ hypertable_modify_begin(CustomScanState *node, EState *estate, int eflags)
|
||||
* we need to set the hypertable as the rootRelation otherwise
|
||||
* statement trigger defined only on the hypertable will not fire.
|
||||
*/
|
||||
if (mt->operation == CMD_DELETE)
|
||||
if (mt->operation == CMD_DELETE || mt->operation == CMD_UPDATE)
|
||||
mt->rootRelation = mt->nominalRelation;
|
||||
|
||||
ps = ExecInitNode(&mt->plan, estate, eflags);
|
||||
|
@ -1042,19 +1042,6 @@ timescaledb_set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rti, Rang
|
||||
switch (reltype)
|
||||
{
|
||||
case TS_REL_HYPERTABLE_CHILD:
|
||||
/* When postgres expands an inheritance tree it also adds the
|
||||
* parent hypertable as child relation. Since for a hypertable the
|
||||
* parent will never have any data we can mark this relation as
|
||||
* dummy relation so it gets ignored in later steps. This is only
|
||||
* relevant for code paths that use the postgres inheritance code
|
||||
* as we don't include the hypertable as child when expanding the
|
||||
* hypertable ourself.
|
||||
* We do exclude distributed hypertables for now to not alter
|
||||
* the trigger behaviour on access nodes, which would otherwise
|
||||
* no longer fire.
|
||||
*/
|
||||
if (root->parse->commandType == CMD_DELETE && !hypertable_is_distributed(ht))
|
||||
mark_dummy_rel(rel);
|
||||
break;
|
||||
case TS_REL_CHUNK:
|
||||
case TS_REL_CHUNK_CHILD:
|
||||
@ -1163,6 +1150,20 @@ timescaledb_get_relation_info_hook(PlannerInfo *root, Oid relation_objectid, boo
|
||||
break;
|
||||
}
|
||||
case TS_REL_HYPERTABLE_CHILD:
|
||||
/* When postgres expands an inheritance tree it also adds the
|
||||
* parent hypertable as child relation. Since for a hypertable the
|
||||
* parent will never have any data we can mark this relation as
|
||||
* dummy relation so it gets ignored in later steps. This is only
|
||||
* relevant for code paths that use the postgres inheritance code
|
||||
* as we don't include the hypertable as child when expanding the
|
||||
* hypertable ourself.
|
||||
* We do exclude distributed hypertables for now to not alter
|
||||
* the trigger behaviour on access nodes, which would otherwise
|
||||
* no longer fire.
|
||||
*/
|
||||
if (IS_UPDL_CMD(root->parse) && !hypertable_is_distributed(ht))
|
||||
mark_dummy_rel(rel);
|
||||
break;
|
||||
case TS_REL_OTHER:
|
||||
break;
|
||||
}
|
||||
|
@ -21,14 +21,9 @@ FETCH NEXT FROM c1;
|
||||
Sat Jan 01 00:00:00 2000 PST | 1 | 0.5
|
||||
(1 row)
|
||||
|
||||
-- this will produce an error because PostgreSQL checks
|
||||
-- this will produce an error on PG < 14 because PostgreSQL checks
|
||||
-- for the existence of a scan node with the relation id for every relation
|
||||
-- used in the update plan in the plan of the cursor.
|
||||
--
|
||||
-- constraint exclusion will make this easier to hit
|
||||
-- because constraint exclusion only works for SELECT
|
||||
-- and UPDATE statements will still have parent tables in
|
||||
-- the generated plans
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
ERROR: cursor "c1" is not a simply updatable scan of table "cursor_test"
|
||||
COMMIT;
|
53
test/expected/cursor-13.out
Normal file
53
test/expected/cursor-13.out
Normal file
@ -0,0 +1,53 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
CREATE TABLE cursor_test(time timestamptz, device_id int, temp float);
|
||||
SELECT create_hypertable('cursor_test','time');
|
||||
NOTICE: adding not-null constraint to column "time"
|
||||
create_hypertable
|
||||
--------------------------
|
||||
(1,public,cursor_test,t)
|
||||
(1 row)
|
||||
|
||||
INSERT INTO cursor_test SELECT '2000-01-01',1,0.5;
|
||||
INSERT INTO cursor_test SELECT '2001-01-01',1,0.5;
|
||||
INSERT INTO cursor_test SELECT '2002-01-01',1,0.5;
|
||||
\set ON_ERROR_STOP 0
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test;
|
||||
FETCH NEXT FROM c1;
|
||||
time | device_id | temp
|
||||
------------------------------+-----------+------
|
||||
Sat Jan 01 00:00:00 2000 PST | 1 | 0.5
|
||||
(1 row)
|
||||
|
||||
-- this will produce an error on PG < 14 because PostgreSQL checks
|
||||
-- for the existence of a scan node with the relation id for every relation
|
||||
-- used in the update plan in the plan of the cursor.
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
ERROR: cursor "c1" is not a simply updatable scan of table "cursor_test"
|
||||
COMMIT;
|
||||
-- test cursor with no chunks left after runtime exclusion
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test WHERE time > now();
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
ERROR: cursor "c1" is not a simply updatable scan of table "cursor_test"
|
||||
COMMIT;
|
||||
-- test cursor with no chunks left after planning exclusion
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test WHERE time > '2010-01-01';
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
ERROR: cursor "c1" is not a simply updatable scan of table "cursor_test"
|
||||
COMMIT;
|
||||
\set ON_ERROR_STOP 1
|
||||
SET timescaledb.enable_constraint_exclusion TO off;
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test;
|
||||
FETCH NEXT FROM c1;
|
||||
time | device_id | temp
|
||||
------------------------------+-----------+------
|
||||
Sat Jan 01 00:00:00 2000 PST | 1 | 0.5
|
||||
(1 row)
|
||||
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
COMMIT;
|
52
test/expected/cursor-14.out
Normal file
52
test/expected/cursor-14.out
Normal file
@ -0,0 +1,52 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
CREATE TABLE cursor_test(time timestamptz, device_id int, temp float);
|
||||
SELECT create_hypertable('cursor_test','time');
|
||||
NOTICE: adding not-null constraint to column "time"
|
||||
create_hypertable
|
||||
--------------------------
|
||||
(1,public,cursor_test,t)
|
||||
(1 row)
|
||||
|
||||
INSERT INTO cursor_test SELECT '2000-01-01',1,0.5;
|
||||
INSERT INTO cursor_test SELECT '2001-01-01',1,0.5;
|
||||
INSERT INTO cursor_test SELECT '2002-01-01',1,0.5;
|
||||
\set ON_ERROR_STOP 0
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test;
|
||||
FETCH NEXT FROM c1;
|
||||
time | device_id | temp
|
||||
------------------------------+-----------+------
|
||||
Sat Jan 01 00:00:00 2000 PST | 1 | 0.5
|
||||
(1 row)
|
||||
|
||||
-- this will produce an error on PG < 14 because PostgreSQL checks
|
||||
-- for the existence of a scan node with the relation id for every relation
|
||||
-- used in the update plan in the plan of the cursor.
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
COMMIT;
|
||||
-- test cursor with no chunks left after runtime exclusion
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test WHERE time > now();
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
ERROR: cursor "c1" is not a simply updatable scan of table "_hyper_1_1_chunk"
|
||||
COMMIT;
|
||||
-- test cursor with no chunks left after planning exclusion
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test WHERE time > '2010-01-01';
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
ERROR: cursor "c1" is not a simply updatable scan of table "_hyper_1_1_chunk"
|
||||
COMMIT;
|
||||
\set ON_ERROR_STOP 1
|
||||
SET timescaledb.enable_constraint_exclusion TO off;
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test;
|
||||
FETCH NEXT FROM c1;
|
||||
time | device_id | temp
|
||||
------------------------------+-----------+------
|
||||
Sat Jan 01 00:00:00 2000 PST | 1 | 0.7
|
||||
(1 row)
|
||||
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
COMMIT;
|
@ -2269,16 +2269,13 @@ EXPLAIN (COSTS OFF) UPDATE bv1 SET b = 'yyy' WHERE a = 4 AND f_leak(b);
|
||||
-----------------------------------------------------------------------------------------
|
||||
Custom Scan (HypertableModify)
|
||||
-> Update on b1
|
||||
Update on b1 b1_1
|
||||
Update on _hyper_8_41_chunk b1_2
|
||||
Update on _hyper_8_41_chunk b1_1
|
||||
-> Custom Scan (ChunkAppend) on b1
|
||||
Chunks excluded during startup: 0
|
||||
-> Seq Scan on b1 b1_1
|
||||
Filter: ((a > 0) AND (a = 4) AND ((a % 2) = 0) AND f_leak(b))
|
||||
-> Index Scan using _hyper_8_41_chunk_b1_a_idx on _hyper_8_41_chunk b1_2
|
||||
-> Index Scan using _hyper_8_41_chunk_b1_a_idx on _hyper_8_41_chunk b1_1
|
||||
Index Cond: ((a > 0) AND (a = 4))
|
||||
Filter: (((a % 2) = 0) AND f_leak(b))
|
||||
(11 rows)
|
||||
(8 rows)
|
||||
|
||||
UPDATE bv1 SET b = 'yyy' WHERE a = 4 AND f_leak(b);
|
||||
NOTICE: f_leak => a87ff679a2f3e71d9181a67b7542122c
|
||||
@ -4353,20 +4350,15 @@ SELECT * FROM current_check;
|
||||
|
||||
-- Plan should be a subquery TID scan
|
||||
EXPLAIN (COSTS OFF) UPDATE current_check SET payload = payload WHERE CURRENT OF current_check_cursor;
|
||||
QUERY PLAN
|
||||
-------------------------------------------------------------------------
|
||||
QUERY PLAN
|
||||
-------------------------------------------------------------------
|
||||
Custom Scan (HypertableModify)
|
||||
-> Update on current_check
|
||||
Update on current_check current_check_1
|
||||
Update on _hyper_21_104_chunk current_check_2
|
||||
-> Append
|
||||
-> Tid Scan on current_check current_check_1
|
||||
TID Cond: CURRENT OF current_check_cursor
|
||||
Filter: ((currentid = 4) AND ((currentid % 2) = 0))
|
||||
-> Tid Scan on _hyper_21_104_chunk current_check_2
|
||||
TID Cond: CURRENT OF current_check_cursor
|
||||
Filter: ((currentid = 4) AND ((currentid % 2) = 0))
|
||||
(11 rows)
|
||||
Update on _hyper_21_104_chunk current_check_1
|
||||
-> Tid Scan on _hyper_21_104_chunk current_check_1
|
||||
TID Cond: CURRENT OF current_check_cursor
|
||||
Filter: ((currentid = 4) AND ((currentid % 2) = 0))
|
||||
(6 rows)
|
||||
|
||||
-- Similarly can only delete row 4
|
||||
FETCH ABSOLUTE 1 FROM current_check_cursor;
|
||||
|
@ -89,12 +89,10 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
Update on _hyper_1_2_chunk
|
||||
Update on _hyper_1_3_chunk
|
||||
-> Hash Join
|
||||
Hash Cond: ("one_Partition_1".series_1 = "one_Partition".series_1)
|
||||
Hash Cond: (_hyper_1_1_chunk_1.series_1 = "one_Partition".series_1)
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition_1".series_1
|
||||
Group Key: _hyper_1_1_chunk_1.series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_1"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk _hyper_1_1_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk _hyper_1_2_chunk_1
|
||||
@ -104,14 +102,12 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> Hash
|
||||
-> Seq Scan on "one_Partition"
|
||||
-> Hash Join
|
||||
Hash Cond: (_hyper_1_1_chunk.series_1 = "one_Partition_1".series_1)
|
||||
Hash Cond: (_hyper_1_1_chunk.series_1 = _hyper_1_1_chunk_1.series_1)
|
||||
-> Seq Scan on _hyper_1_1_chunk
|
||||
-> Hash
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition_1".series_1
|
||||
Group Key: _hyper_1_1_chunk_1.series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_1"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk _hyper_1_1_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk _hyper_1_2_chunk_1
|
||||
@ -119,14 +115,12 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk _hyper_1_3_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Hash Join
|
||||
Hash Cond: (_hyper_1_2_chunk.series_1 = "one_Partition_1".series_1)
|
||||
Hash Cond: (_hyper_1_2_chunk.series_1 = _hyper_1_1_chunk_1.series_1)
|
||||
-> Seq Scan on _hyper_1_2_chunk
|
||||
-> Hash
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition_1".series_1
|
||||
Group Key: _hyper_1_1_chunk_1.series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_1"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk _hyper_1_1_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk _hyper_1_2_chunk_1
|
||||
@ -134,21 +128,19 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk _hyper_1_3_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Hash Join
|
||||
Hash Cond: (_hyper_1_3_chunk.series_1 = "one_Partition_1".series_1)
|
||||
Hash Cond: (_hyper_1_3_chunk.series_1 = _hyper_1_1_chunk_1.series_1)
|
||||
-> Seq Scan on _hyper_1_3_chunk
|
||||
-> Hash
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition_1".series_1
|
||||
Group Key: _hyper_1_1_chunk_1.series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_1"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk _hyper_1_1_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk _hyper_1_2_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk _hyper_1_3_chunk_1
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
(65 rows)
|
||||
(57 rows)
|
||||
|
||||
SELECT * FROM "one_Partition" ORDER BY "timeCustom", device_id, series_0, series_1, series_2;
|
||||
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
|
||||
|
@ -93,13 +93,11 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition".series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_5"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_6"
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_5"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_7"
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_6"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_8"
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_7"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Hash
|
||||
-> Seq Scan on "one_Partition" "one_Partition_1"
|
||||
@ -110,13 +108,11 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition".series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_5"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_6"
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_5"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_7"
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_6"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_8"
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_7"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Hash Join
|
||||
Hash Cond: ("one_Partition_3".series_1 = "one_Partition".series_1)
|
||||
@ -125,13 +121,11 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition".series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_5"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_6"
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_5"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_7"
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_6"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_8"
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_7"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Hash Join
|
||||
Hash Cond: ("one_Partition_4".series_1 = "one_Partition".series_1)
|
||||
@ -140,15 +134,13 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition".series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_5"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_6"
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_5"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_7"
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_6"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_8"
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_7"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
(65 rows)
|
||||
(57 rows)
|
||||
|
||||
SELECT * FROM "one_Partition" ORDER BY "timeCustom", device_id, series_0, series_1, series_2;
|
||||
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
|
||||
|
@ -85,30 +85,26 @@ WHERE series_1 IN (SELECT series_1 FROM "one_Partition" WHERE series_1 > series_
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Custom Scan (HypertableModify)
|
||||
-> Update on "one_Partition"
|
||||
Update on "one_Partition" "one_Partition_2"
|
||||
Update on _hyper_1_1_chunk "one_Partition_3"
|
||||
Update on _hyper_1_2_chunk "one_Partition_4"
|
||||
Update on _hyper_1_3_chunk "one_Partition_5"
|
||||
Update on _hyper_1_1_chunk "one_Partition_2"
|
||||
Update on _hyper_1_2_chunk "one_Partition_3"
|
||||
Update on _hyper_1_3_chunk "one_Partition_4"
|
||||
-> Hash Join
|
||||
Hash Cond: ("one_Partition".series_1 = "one_Partition_1".series_1)
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_2"
|
||||
-> Seq Scan on _hyper_1_1_chunk "one_Partition_3"
|
||||
-> Seq Scan on _hyper_1_2_chunk "one_Partition_4"
|
||||
-> Seq Scan on _hyper_1_3_chunk "one_Partition_5"
|
||||
-> Seq Scan on _hyper_1_1_chunk "one_Partition_2"
|
||||
-> Seq Scan on _hyper_1_2_chunk "one_Partition_3"
|
||||
-> Seq Scan on _hyper_1_3_chunk "one_Partition_4"
|
||||
-> Hash
|
||||
-> HashAggregate
|
||||
Group Key: "one_Partition_1".series_1
|
||||
-> Append
|
||||
-> Seq Scan on "one_Partition" "one_Partition_6"
|
||||
Filter: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_7"
|
||||
-> Index Scan using "_hyper_1_1_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_1_chunk "one_Partition_5"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_8"
|
||||
-> Index Scan using "_hyper_1_2_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_2_chunk "one_Partition_6"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_9"
|
||||
-> Index Scan using "_hyper_1_3_chunk_one_Partition_timeCustom_series_1_idx" on _hyper_1_3_chunk "one_Partition_7"
|
||||
Index Cond: (series_1 > (series_val())::double precision)
|
||||
(25 rows)
|
||||
(21 rows)
|
||||
|
||||
SELECT * FROM "one_Partition" ORDER BY "timeCustom", device_id, series_0, series_1, series_2;
|
||||
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
|
||||
|
1
test/sql/.gitignore
vendored
1
test/sql/.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
/append-*.sql
|
||||
/cluster-*.sql
|
||||
/constraint-*.sql
|
||||
/cursor-*.sql
|
||||
/copy-*.sql
|
||||
/ddl-*.sql
|
||||
/delete-*.sql
|
||||
|
@ -10,7 +10,6 @@ set(TEST_FILES
|
||||
create_chunks.sql
|
||||
create_hypertable.sql
|
||||
create_table.sql
|
||||
cursor.sql
|
||||
ddl_errors.sql
|
||||
drop_extension.sql
|
||||
drop_hypertable.sql
|
||||
@ -61,6 +60,7 @@ set(TEST_TEMPLATES
|
||||
cluster.sql.in
|
||||
constraint.sql.in
|
||||
copy.sql.in
|
||||
cursor.sql.in
|
||||
ddl.sql.in
|
||||
delete.sql.in
|
||||
partitionwise.sql.in
|
||||
|
@ -13,14 +13,9 @@ INSERT INTO cursor_test SELECT '2002-01-01',1,0.5;
|
||||
BEGIN;
|
||||
DECLARE c1 SCROLL CURSOR FOR SELECT * FROM cursor_test;
|
||||
FETCH NEXT FROM c1;
|
||||
-- this will produce an error because PostgreSQL checks
|
||||
-- this will produce an error on PG < 14 because PostgreSQL checks
|
||||
-- for the existence of a scan node with the relation id for every relation
|
||||
-- used in the update plan in the plan of the cursor.
|
||||
--
|
||||
-- constraint exclusion will make this easier to hit
|
||||
-- because constraint exclusion only works for SELECT
|
||||
-- and UPDATE statements will still have parent tables in
|
||||
-- the generated plans
|
||||
UPDATE cursor_test SET temp = 0.7 WHERE CURRENT OF c1;
|
||||
COMMIT;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user