-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PG16: Fix transparent decompression output tests
- Loading branch information
1 parent
187b124
commit b4bb3a0
Showing
12 changed files
with
542 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
101 changes: 101 additions & 0 deletions
101
tsl/test/expected/transparent_decompression_join_index-14.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
-- This file and its contents are licensed under the Timescale License. | ||
-- Please see the included NOTICE for copyright information and | ||
-- LICENSE-TIMESCALE for a copy of the license. | ||
\c :TEST_DBNAME :ROLE_SUPERUSER | ||
-- github issue 5585 | ||
create table test ( | ||
time timestamptz not null, | ||
a varchar(255) not null, | ||
b int, | ||
c int | ||
); | ||
SELECT create_hypertable('test', 'time'); | ||
WARNING: column type "character varying" used for "a" does not follow best practices | ||
create_hypertable | ||
------------------- | ||
(1,public,test,t) | ||
(1 row) | ||
|
||
insert into test values | ||
('2020-01-01 00:00'::timestamptz, 'lat', 1, 2), | ||
('2020-01-01 00:01'::timestamptz, 'lat', 1, 2), | ||
('2020-01-01 00:01'::timestamptz, 'lat', 2, 2), | ||
('2020-01-01 00:03'::timestamptz, 'lat', 1, 2), | ||
('2020-01-01 00:01'::timestamptz, 'lon', 1, 2); | ||
create table test_copy as select * from test; | ||
-- compress the chunk | ||
alter table test set (timescaledb.compress, timescaledb.compress_segmentby='a, b'); | ||
select compress_chunk(show_chunks('test')); | ||
compress_chunk | ||
---------------------------------------- | ||
_timescaledb_internal._hyper_1_1_chunk | ||
(1 row) | ||
|
||
-- force an index scan | ||
set enable_seqscan = 'off'; | ||
-- disable jit to avoid test flakiness | ||
set jit = off; | ||
explain (costs off) with query_params as ( | ||
select distinct a, b | ||
from test_copy | ||
where test_copy.a IN ('lat', 'lon') | ||
and test_copy.b IN (1) | ||
) | ||
select | ||
test.time, | ||
test.a = q.a as "this should never be false", | ||
test.a, | ||
test.b, | ||
test.c, | ||
q.* | ||
from | ||
test inner join query_params q | ||
on q.a = test.a and q.b = test.b | ||
where test.time between '2020-01-01 00:00' and '2020-01-01 00:02' | ||
order by test.time; | ||
QUERY PLAN | ||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
Sort | ||
Sort Key: _hyper_1_1_chunk."time" | ||
-> Nested Loop | ||
-> Unique | ||
-> Sort | ||
Sort Key: test_copy.a | ||
-> Seq Scan on test_copy | ||
Filter: (((a)::text = ANY ('{lat,lon}'::text[])) AND (b = 1)) | ||
-> Custom Scan (DecompressChunk) on _hyper_1_1_chunk | ||
Vectorized Filter: (("time" >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND ("time" <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) | ||
-> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_a_b__ts_meta_ on compress_hyper_2_2_chunk | ||
Index Cond: ((a = (test_copy.a)::text) AND (b = test_copy.b)) | ||
Filter: ((_ts_meta_max_1 >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND (_ts_meta_min_1 <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) | ||
(13 rows) | ||
|
||
with query_params as ( | ||
select distinct a, b | ||
from test_copy | ||
where test_copy.a IN ('lat', 'lon') | ||
and test_copy.b IN (1) | ||
) | ||
select | ||
test.time, | ||
test.a = q.a as "this should never be false", | ||
test.a, | ||
test.b, | ||
test.c, | ||
q.* | ||
from | ||
test inner join query_params q | ||
on q.a = test.a and q.b = test.b | ||
where test.time between '2020-01-01 00:00' and '2020-01-01 00:02' | ||
order by test.time; | ||
time | this should never be false | a | b | c | a | b | ||
------------------------------+----------------------------+-----+---+---+-----+--- | ||
Wed Jan 01 00:00:00 2020 PST | t | lat | 1 | 2 | lat | 1 | ||
Wed Jan 01 00:01:00 2020 PST | t | lat | 1 | 2 | lat | 1 | ||
Wed Jan 01 00:01:00 2020 PST | t | lon | 1 | 2 | lon | 1 | ||
(3 rows) | ||
|
||
reset enable_seqscan; | ||
reset jit; | ||
drop table test; | ||
drop table test_copy; |
101 changes: 101 additions & 0 deletions
101
tsl/test/expected/transparent_decompression_join_index-15.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
-- This file and its contents are licensed under the Timescale License. | ||
-- Please see the included NOTICE for copyright information and | ||
-- LICENSE-TIMESCALE for a copy of the license. | ||
\c :TEST_DBNAME :ROLE_SUPERUSER | ||
-- github issue 5585 | ||
create table test ( | ||
time timestamptz not null, | ||
a varchar(255) not null, | ||
b int, | ||
c int | ||
); | ||
SELECT create_hypertable('test', 'time'); | ||
WARNING: column type "character varying" used for "a" does not follow best practices | ||
create_hypertable | ||
------------------- | ||
(1,public,test,t) | ||
(1 row) | ||
|
||
insert into test values | ||
('2020-01-01 00:00'::timestamptz, 'lat', 1, 2), | ||
('2020-01-01 00:01'::timestamptz, 'lat', 1, 2), | ||
('2020-01-01 00:01'::timestamptz, 'lat', 2, 2), | ||
('2020-01-01 00:03'::timestamptz, 'lat', 1, 2), | ||
('2020-01-01 00:01'::timestamptz, 'lon', 1, 2); | ||
create table test_copy as select * from test; | ||
-- compress the chunk | ||
alter table test set (timescaledb.compress, timescaledb.compress_segmentby='a, b'); | ||
select compress_chunk(show_chunks('test')); | ||
compress_chunk | ||
---------------------------------------- | ||
_timescaledb_internal._hyper_1_1_chunk | ||
(1 row) | ||
|
||
-- force an index scan | ||
set enable_seqscan = 'off'; | ||
-- disable jit to avoid test flakiness | ||
set jit = off; | ||
explain (costs off) with query_params as ( | ||
select distinct a, b | ||
from test_copy | ||
where test_copy.a IN ('lat', 'lon') | ||
and test_copy.b IN (1) | ||
) | ||
select | ||
test.time, | ||
test.a = q.a as "this should never be false", | ||
test.a, | ||
test.b, | ||
test.c, | ||
q.* | ||
from | ||
test inner join query_params q | ||
on q.a = test.a and q.b = test.b | ||
where test.time between '2020-01-01 00:00' and '2020-01-01 00:02' | ||
order by test.time; | ||
QUERY PLAN | ||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
Sort | ||
Sort Key: _hyper_1_1_chunk."time" | ||
-> Nested Loop | ||
-> Unique | ||
-> Sort | ||
Sort Key: test_copy.a | ||
-> Seq Scan on test_copy | ||
Filter: (((a)::text = ANY ('{lat,lon}'::text[])) AND (b = 1)) | ||
-> Custom Scan (DecompressChunk) on _hyper_1_1_chunk | ||
Vectorized Filter: (("time" >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND ("time" <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) | ||
-> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_a_b__ts_meta_ on compress_hyper_2_2_chunk | ||
Index Cond: ((a = (test_copy.a)::text) AND (b = test_copy.b)) | ||
Filter: ((_ts_meta_max_1 >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND (_ts_meta_min_1 <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) | ||
(13 rows) | ||
|
||
with query_params as ( | ||
select distinct a, b | ||
from test_copy | ||
where test_copy.a IN ('lat', 'lon') | ||
and test_copy.b IN (1) | ||
) | ||
select | ||
test.time, | ||
test.a = q.a as "this should never be false", | ||
test.a, | ||
test.b, | ||
test.c, | ||
q.* | ||
from | ||
test inner join query_params q | ||
on q.a = test.a and q.b = test.b | ||
where test.time between '2020-01-01 00:00' and '2020-01-01 00:02' | ||
order by test.time; | ||
time | this should never be false | a | b | c | a | b | ||
------------------------------+----------------------------+-----+---+---+-----+--- | ||
Wed Jan 01 00:00:00 2020 PST | t | lat | 1 | 2 | lat | 1 | ||
Wed Jan 01 00:01:00 2020 PST | t | lat | 1 | 2 | lat | 1 | ||
Wed Jan 01 00:01:00 2020 PST | t | lon | 1 | 2 | lon | 1 | ||
(3 rows) | ||
|
||
reset enable_seqscan; | ||
reset jit; | ||
drop table test; | ||
drop table test_copy; |
Oops, something went wrong.