Skip to content

Commit 90f3ab0

Browse files
committed
template
1 parent 2380441 commit 90f3ab0

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

tsl/test/sql/compress_bloom_sparse.sql.in

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ select count(compress_chunk(x)) from show_chunks('bloom') x;
3131
select * from settings;
3232
vacuum full analyze bloom;
3333

34-
select schema_name || '.' || table_name chunk from _timescaledb_catalog.chunk
35-
where id = (select compressed_chunk_id from _timescaledb_catalog.chunk
36-
where hypertable_id = (select id from _timescaledb_catalog.hypertable
37-
where table_name = 'bloom') limit 1)
34+
select cs.compress_relid::regclass chunk from _timescaledb_catalog.chunk ch
35+
join _timescaledb_catalog.compression_settings cs
36+
on cs.relid = format('%I.%I', ch.schema_name, ch.table_name)::regclass
37+
where ch.hypertable_id = (select id from _timescaledb_catalog.hypertable
38+
where table_name = 'bloom') limit 1
3839
\gset
3940

4041
select * from test.show_columns_ext(:'chunk'::regclass);
@@ -288,10 +289,11 @@ select count(compress_chunk(x)) from show_chunks('badtable') x;
288289

289290
vacuum full analyze badtable;
290291

291-
select schema_name || '.' || table_name chunk from _timescaledb_catalog.chunk
292-
where id = (select compressed_chunk_id from _timescaledb_catalog.chunk
293-
where hypertable_id = (select id from _timescaledb_catalog.hypertable
294-
where table_name = 'badtable') limit 1)
292+
select cs.compress_relid::regclass chunk from _timescaledb_catalog.chunk ch
293+
join _timescaledb_catalog.compression_settings cs
294+
on cs.relid = format('%I.%I', ch.schema_name, ch.table_name)::regclass
295+
where ch.hypertable_id = (select id from _timescaledb_catalog.hypertable
296+
where table_name = 'badtable') limit 1
295297
\gset
296298

297299
select * from test.show_columns_ext(:'chunk'::regclass);
@@ -324,10 +326,11 @@ select * from settings;
324326
vacuum full analyze badtable;
325327

326328
-- Verify that we actually got the bloom filter index.
327-
select schema_name || '.' || table_name chunk from _timescaledb_catalog.chunk
328-
where id = (select compressed_chunk_id from _timescaledb_catalog.chunk
329-
where hypertable_id = (select id from _timescaledb_catalog.hypertable
330-
where table_name = 'badtable') limit 1)
329+
select cs.compress_relid::regclass chunk from _timescaledb_catalog.chunk ch
330+
join _timescaledb_catalog.compression_settings cs
331+
on cs.relid = format('%I.%I', ch.schema_name, ch.table_name)::regclass
332+
where ch.hypertable_id = (select id from _timescaledb_catalog.hypertable
333+
where table_name = 'badtable') limit 1
331334
\gset
332335

333336
select * from test.show_columns_ext(:'chunk'::regclass);

tsl/test/sql/compression_update_delete.sql.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ SELECT
1616
FROM
1717
_timescaledb_catalog.hypertable h JOIN
1818
_timescaledb_catalog.chunk c ON h.id = c.hypertable_id
19+
LEFT JOIN _timescaledb_catalog.compression_settings cs
20+
ON cs.relid = format('%I.%I', c.schema_name, c.table_name)::regclass
1921
LEFT JOIN _timescaledb_catalog.chunk comp
20-
ON comp.id = c.compressed_chunk_id
22+
ON cs.compress_relid = format('%I.%I', comp.schema_name, comp.table_name)::regclass
2123
;
2224

2325
CREATE TABLE sample_table (
@@ -1158,10 +1160,11 @@ AND ch1.table_name LIKE '_hyper%'
11581160
ORDER BY ch1.id LIMIT 1 \gset
11591161

11601162
SELECT ch2.schema_name|| '.' || ch2.table_name AS "COMP_CHUNK_1"
1161-
FROM _timescaledb_catalog.chunk ch1, _timescaledb_catalog.chunk ch2, _timescaledb_catalog.hypertable ht
1163+
FROM _timescaledb_catalog.chunk ch1, _timescaledb_catalog.chunk ch2, _timescaledb_catalog.hypertable ht, _timescaledb_catalog.compression_settings cs
11621164
WHERE ht.table_name = 'index_scan_test'
11631165
AND ch1.hypertable_id = ht.id
1164-
AND ch1.compressed_chunk_id = ch2.id
1166+
AND cs.relid = format('%I.%I', ch1.schema_name, ch1.table_name)::regclass
1167+
AND cs.compress_relid = format('%I.%I', ch2.schema_name, ch2.table_name)::regclass
11651168
ORDER BY ch2.id LIMIT 1 \gset
11661169

11671170
INSERT INTO index_scan_test(time,device_id,value) SELECT time, device_id, device_id + 0.5 FROM generate_series('2000-01-01 0:00:00+0'::timestamptz,'2000-01-05 23:55:00+0','1m') gtime(time), generate_series(1,5,1) gdevice(device_id);

0 commit comments

Comments
 (0)