Skip to content

Commit

Permalink
Fix flaky ordered append regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziomello committed Mar 3, 2025
1 parent 326688a commit 702cbc3
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 54 deletions.
1 change: 1 addition & 0 deletions tsl/test/shared/expected/ordered_append-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
set max_parallel_workers_per_gather to 0;
set enable_nestloop to off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
1 change: 1 addition & 0 deletions tsl/test/shared/expected/ordered_append-15.out
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
set max_parallel_workers_per_gather to 0;
set enable_nestloop to off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
1 change: 1 addition & 0 deletions tsl/test/shared/expected/ordered_append-16.out
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
set max_parallel_workers_per_gather to 0;
set enable_nestloop to off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
1 change: 1 addition & 0 deletions tsl/test/shared/expected/ordered_append-17.out
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
set max_parallel_workers_per_gather to 0;
set enable_nestloop to off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand Down
25 changes: 13 additions & 12 deletions tsl/test/shared/expected/ordered_append_join-14.out
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed res
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
set max_parallel_workers_per_gather to 0;
set enable_nestloop to off;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Timescale License.
Expand All @@ -30,6 +31,7 @@ set max_parallel_workers_per_gather to 0;
-- SequentialScans. Disable the optimization for the following tests to ensure we have
-- stable query plans in all CI environments.
SET timescaledb.enable_decompression_sorted_merge = 0;
SET enable_nestloop TO on;
-- test LATERAL with ordered append in the outer query
:PREFIX
SELECT time,
Expand Down Expand Up @@ -79,6 +81,7 @@ QUERY PLAN
-> Index Scan using _hyper_X_X_chunk_metrics_time_idx on _hyper_X_X_chunk (never executed)
(10 rows)

SET enable_nestloop TO off;
-- test plan with best index is chosen
-- this should use device_id, time index
:PREFIX
Expand Down Expand Up @@ -116,6 +119,7 @@ QUERY PLAN
-> Index Scan using _hyper_X_X_chunk_metrics_time_idx on _hyper_X_X_chunk (never executed)
(6 rows)

SET enable_nestloop TO on;
-- test LATERAL with correlated query
-- only last chunk should be executed
:PREFIX
Expand Down Expand Up @@ -261,7 +265,6 @@ QUERY PLAN
Index Cond: ((device_id = 2) AND ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone))
(19 rows)

RESET enable_nestloop;
-- test JOIN
-- last chunk of o2 should not be executed
:PREFIX
Expand Down Expand Up @@ -296,7 +299,6 @@ QUERY PLAN
-- test join against max query
-- not ChunkAppend so no chunk exclusion
SET enable_hashjoin = FALSE;
SET enable_nestloop = FALSE;
SET enable_hashagg = FALSE;
:PREFIX
SELECT o1.time,
Expand Down Expand Up @@ -335,7 +337,6 @@ QUERY PLAN
(24 rows)

RESET enable_hashjoin;
RESET enable_nestloop;
RESET enable_hashagg;
SET enable_seqscan TO false;
-- test JOIN on time column
Expand Down Expand Up @@ -740,6 +741,7 @@ RESET enable_seqscan;
-- SequentialScans. Disable the optimization for the following tests to ensure we have
-- stable query plans in all CI environments.
SET timescaledb.enable_decompression_sorted_merge = 0;
SET enable_nestloop TO on;
-- test LATERAL with ordered append in the outer query
:PREFIX
SELECT time,
Expand Down Expand Up @@ -813,6 +815,7 @@ QUERY PLAN
-> Index Scan Backward using _hyper_X_X_chunk_metrics_space_time_idx on _hyper_X_X_chunk (never executed)
(22 rows)

SET enable_nestloop TO off;
-- test plan with best index is chosen
-- this should use device_id, time index
:PREFIX
Expand Down Expand Up @@ -862,6 +865,7 @@ QUERY PLAN
-> Index Scan Backward using _hyper_X_X_chunk_metrics_space_time_idx on _hyper_X_X_chunk (never executed)
(18 rows)

SET enable_nestloop TO on;
-- test LATERAL with correlated query
-- only last chunk should be executed
:PREFIX
Expand Down Expand Up @@ -1081,7 +1085,6 @@ QUERY PLAN
Index Cond: ((device_id = 2) AND ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone))
(22 rows)

RESET enable_nestloop;
-- test JOIN
-- last chunk of o2 should not be executed
:PREFIX
Expand Down Expand Up @@ -1140,7 +1143,6 @@ QUERY PLAN
-- test join against max query
-- not ChunkAppend so no chunk exclusion
SET enable_hashjoin = FALSE;
SET enable_nestloop = FALSE;
SET enable_hashagg = FALSE;
:PREFIX
SELECT o1.time,
Expand Down Expand Up @@ -1197,7 +1199,6 @@ QUERY PLAN
(42 rows)

RESET enable_hashjoin;
RESET enable_nestloop;
RESET enable_hashagg;
SET enable_seqscan TO false;
-- test JOIN on time column
Expand Down Expand Up @@ -1626,6 +1627,7 @@ RESET enable_seqscan;
-- SequentialScans. Disable the optimization for the following tests to ensure we have
-- stable query plans in all CI environments.
SET timescaledb.enable_decompression_sorted_merge = 0;
SET enable_nestloop TO on;
-- test LATERAL with ordered append in the outer query
:PREFIX
SELECT time,
Expand Down Expand Up @@ -1695,6 +1697,7 @@ QUERY PLAN
-> Seq Scan on compress_hyper_X_X_chunk (never executed)
(20 rows)

SET enable_nestloop TO off;
-- test plan with best index is chosen
-- this should use device_id, time index
:PREFIX
Expand Down Expand Up @@ -1745,6 +1748,7 @@ QUERY PLAN
-> Seq Scan on compress_hyper_X_X_chunk (never executed)
(16 rows)

SET enable_nestloop TO on;
-- test LATERAL with correlated query
-- only last chunk should be executed
:PREFIX
Expand Down Expand Up @@ -1950,7 +1954,6 @@ QUERY PLAN
Index Cond: ((device_id = 2) AND (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone))
(31 rows)

RESET enable_nestloop;
-- test JOIN
-- last chunk of o2 should not be executed
:PREFIX
Expand Down Expand Up @@ -2004,7 +2007,6 @@ QUERY PLAN
-- test join against max query
-- not ChunkAppend so no chunk exclusion
SET enable_hashjoin = FALSE;
SET enable_nestloop = FALSE;
SET enable_hashagg = FALSE;
:PREFIX
SELECT o1.time,
Expand Down Expand Up @@ -2056,7 +2058,6 @@ QUERY PLAN
(37 rows)

RESET enable_hashjoin;
RESET enable_nestloop;
RESET enable_hashagg;
SET enable_seqscan TO false;
-- test JOIN on time column
Expand Down Expand Up @@ -2531,6 +2532,7 @@ RESET enable_seqscan;
-- SequentialScans. Disable the optimization for the following tests to ensure we have
-- stable query plans in all CI environments.
SET timescaledb.enable_decompression_sorted_merge = 0;
SET enable_nestloop TO on;
-- test LATERAL with ordered append in the outer query
:PREFIX
SELECT time,
Expand Down Expand Up @@ -2664,6 +2666,7 @@ QUERY PLAN
-> Seq Scan on compress_hyper_X_X_chunk (never executed)
(52 rows)

SET enable_nestloop TO off;
-- test plan with best index is chosen
-- this should use device_id, time index
:PREFIX
Expand Down Expand Up @@ -2746,6 +2749,7 @@ QUERY PLAN
-> Seq Scan on compress_hyper_X_X_chunk (never executed)
(48 rows)

SET enable_nestloop TO on;
-- test LATERAL with correlated query
-- only last chunk should be executed
:PREFIX
Expand Down Expand Up @@ -3214,7 +3218,6 @@ QUERY PLAN
Index Cond: ((device_id = 2) AND (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone))
(31 rows)

RESET enable_nestloop;
-- test JOIN
-- last chunk of o2 should not be executed
:PREFIX
Expand Down Expand Up @@ -3330,7 +3333,6 @@ QUERY PLAN
-- test join against max query
-- not ChunkAppend so no chunk exclusion
SET enable_hashjoin = FALSE;
SET enable_nestloop = FALSE;
SET enable_hashagg = FALSE;
:PREFIX
SELECT o1.time,
Expand Down Expand Up @@ -3420,7 +3422,6 @@ QUERY PLAN
(75 rows)

RESET enable_hashjoin;
RESET enable_nestloop;
RESET enable_hashagg;
SET enable_seqscan TO false;
-- test JOIN on time column
Expand Down
Loading

0 comments on commit 702cbc3

Please sign in to comment.