From 0009ebde1aa8e163c0f28d5dd1f69f73b06d6616 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 19 Dec 2024 17:03:17 +0100 Subject: [PATCH] debug the tests --- .github/gh_matrix_builder.py | 6 +- .../expected/compression_qualpushdown.out | 56 ++++++++++--------- .../compression_sorted_merge_distinct.out | 21 ++++--- tsl/test/sql/compression_qualpushdown.sql | 4 +- .../sql/compression_sorted_merge_distinct.sql | 2 +- 5 files changed, 50 insertions(+), 39 deletions(-) diff --git a/.github/gh_matrix_builder.py b/.github/gh_matrix_builder.py index 6d9a8606a40..a4a8f91896d 100755 --- a/.github/gh_matrix_builder.py +++ b/.github/gh_matrix_builder.py @@ -24,6 +24,7 @@ import json import os +import random import subprocess from ci_settings import ( PG14_EARLIEST, @@ -309,11 +310,12 @@ def macos_config(overrides): sys.exit(1) if tests: + to_run = " ".join(random.shuffle(list(tests) * 20)) m["include"].append( build_debug_config( { "coverage": False, - "installcheck_args": f'TESTS="{" ".join(list(tests) * 20)}"', + "installcheck_args": f'TESTS="{to_run}"', "name": "Flaky Check Debug", "pg": PG16_LATEST, "pginstallcheck": False, @@ -324,7 +326,7 @@ def macos_config(overrides): build_debug_config( { "coverage": False, - "installcheck_args": f'TESTS="{" ".join(list(tests) * 20)}"', + "installcheck_args": f'TESTS="{to_run}"', "name": "Flaky Check Debug", "pg": PG17_LATEST, "pginstallcheck": False, diff --git a/tsl/test/expected/compression_qualpushdown.out b/tsl/test/expected/compression_qualpushdown.out index 2b943c67917..763854664f6 100644 --- a/tsl/test/expected/compression_qualpushdown.out +++ b/tsl/test/expected/compression_qualpushdown.out @@ -274,6 +274,7 @@ EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar'::cha Filter: ((dev_vc)::bpchar = 'varchar '::character(10)) (4 rows) +RESET enable_seqscan; -- github issue #5286 CREATE TABLE deleteme AS SELECT generate_series AS timestamp, 1 AS segment, 0 AS data @@ -299,18 +300,20 @@ SELECT compress_chunk(i) FROM show_chunks('deleteme') i; (1 row) VACUUM ANALYZE deleteme; -EXPLAIN (costs off) SELECT sum(data) FROM deleteme WHERE segment::text like '%4%'; - QUERY PLAN ------------------------------------------------------------------------------ - Finalize Aggregate - -> Gather +EXPLAIN (analyze, timing off, summary off) SELECT sum(data) FROM deleteme WHERE segment::text like '%4%'; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- + Finalize Aggregate (cost=3235.23..3235.24 rows=1 width=8) (actual rows=1 loops=1) + -> Gather (cost=3235.12..3235.23 rows=1 width=8) (actual rows=2 loops=1) Workers Planned: 1 - -> Partial Aggregate - -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_7_8_chunk - -> Parallel Seq Scan on compress_hyper_8_9_chunk + Workers Launched: 1 + -> Partial Aggregate (cost=2235.12..2235.13 rows=1 width=8) (actual rows=1 loops=2) + -> Parallel Append (cost=0.06..1790.12 rows=178000 width=4) (actual rows=0 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_7_8_chunk (cost=0.06..1790.12 rows=178000 width=4) (actual rows=0 loops=1) + -> Parallel Seq Scan on compress_hyper_8_9_chunk (cost=0.00..10.12 rows=178 width=40) (actual rows=0 loops=1) Filter: ((segment)::text ~~ '%4%'::text) -(8 rows) + Rows Removed by Filter: 303 +(10 rows) EXPLAIN (costs off) SELECT sum(data) FROM deleteme WHERE '4' = segment::text; QUERY PLAN @@ -531,35 +534,35 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_name = CURRENT_SCHEMA; (5 rows) EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_bool; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk - Index Cond: (c_bool = true) + -> Seq Scan on compress_hyper_12_13_chunk + Filter: c_bool (3 rows) EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_bool = true; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk - Index Cond: (c_bool = true) + -> Seq Scan on compress_hyper_12_13_chunk + Filter: c_bool (3 rows) EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_bool = false; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk - Index Cond: (c_bool = false) + -> Seq Scan on compress_hyper_12_13_chunk + Filter: (NOT c_bool) (3 rows) EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE NOT c_bool; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk - Index Cond: (c_bool = false) + -> Seq Scan on compress_hyper_12_13_chunk + Filter: (NOT c_bool) (3 rows) -- current_query() is not a sqlvaluefunction and volatile so should not be pushed down @@ -585,3 +588,4 @@ LATERAL( -- (1 row) +DROP TABLE svf_pushdown; diff --git a/tsl/test/expected/compression_sorted_merge_distinct.out b/tsl/test/expected/compression_sorted_merge_distinct.out index d4d58a9f6b9..02ebee48757 100644 --- a/tsl/test/expected/compression_sorted_merge_distinct.out +++ b/tsl/test/expected/compression_sorted_merge_distinct.out @@ -30,17 +30,20 @@ select count(compress_chunk(x, true)) from show_chunks('t') x; (1 row) analyze t; -explain (costs off) select * from t order by ts; - QUERY PLAN ------------------------------------------------------------------------ - Gather Merge +explain (analyze, timing off, summary off) select * from t order by ts; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- + Gather Merge (cost=152820.15..294845.15 rows=1235000 width=24) (actual rows=840000 loops=1) Workers Planned: 1 - -> Sort + Workers Launched: 1 + -> Sort (cost=151820.14..154907.64 rows=1235000 width=24) (actual rows=420000 loops=2) Sort Key: _hyper_1_1_chunk.ts - -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_2_2_chunk -(7 rows) + Sort Method: external merge Disk: 15128kB + Worker 0: Sort Method: external merge Disk: 12888kB + -> Parallel Append (cost=0.03..12388.35 rows=1235000 width=24) (actual rows=420000 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (cost=0.03..12388.35 rows=1235000 width=24) (actual rows=420000 loops=2) + -> Parallel Seq Scan on compress_hyper_2_2_chunk (cost=0.00..38.35 rows=1235 width=92) (actual rows=1050 loops=2) +(10 rows) explain (costs off) select * from t where low_card = 1 order by ts; QUERY PLAN diff --git a/tsl/test/sql/compression_qualpushdown.sql b/tsl/test/sql/compression_qualpushdown.sql index d62d18879fb..f9b2f637edb 100644 --- a/tsl/test/sql/compression_qualpushdown.sql +++ b/tsl/test/sql/compression_qualpushdown.sql @@ -122,6 +122,7 @@ EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar'; EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_c = 'char'; EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar' AND dev_c = 'char'; EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar'::char(10) AND dev_c = 'char'::varchar; +RESET enable_seqscan; -- github issue #5286 CREATE TABLE deleteme AS @@ -138,7 +139,7 @@ ALTER TABLE deleteme SET ( SELECT compress_chunk(i) FROM show_chunks('deleteme') i; VACUUM ANALYZE deleteme; -EXPLAIN (costs off) SELECT sum(data) FROM deleteme WHERE segment::text like '%4%'; +EXPLAIN (analyze, timing off, summary off) SELECT sum(data) FROM deleteme WHERE segment::text like '%4%'; EXPLAIN (costs off) SELECT sum(data) FROM deleteme WHERE '4' = segment::text; CREATE TABLE deleteme_with_bytea(time bigint NOT NULL, bdata bytea); @@ -200,3 +201,4 @@ LATERAL( EXISTS (SELECT FROM meta) LIMIT 1 ) l; +DROP TABLE svf_pushdown; diff --git a/tsl/test/sql/compression_sorted_merge_distinct.sql b/tsl/test/sql/compression_sorted_merge_distinct.sql index 5e8ee200465..2ad05e44fbe 100644 --- a/tsl/test/sql/compression_sorted_merge_distinct.sql +++ b/tsl/test/sql/compression_sorted_merge_distinct.sql @@ -23,7 +23,7 @@ alter table t set (timescaledb.compress = true, timescaledb.compress_segmentby = select count(compress_chunk(x, true)) from show_chunks('t') x; analyze t; -explain (costs off) select * from t order by ts; +explain (analyze, timing off, summary off) select * from t order by ts; explain (costs off) select * from t where low_card = 1 order by ts; explain (costs off) select * from t where high_card = 1 order by ts; explain (costs off) select * from t where low_card = 1 and high_card = 1 order by ts;