@@ -25,18 +25,18 @@ SELECT * FROM compress ORDER BY time DESC, small_cardinality, large_cardinality,
25
25
\x on
26
26
WITH hypertables AS (
27
27
SELECT ht .id hypertable_id,
28
- ht .schema_name ,
29
- ht .table_name ,
30
- ht .compressed_hypertable_id
28
+ ht .schema_name ,
29
+ ht .table_name ,
30
+ ht .compressed_hypertable_id
31
31
FROM pg_class cl JOIN pg_namespace ns ON ns .oid = relnamespace
32
- JOIN _timescaledb_catalog .hypertable ht ON relname = ht .table_name AND nspname = ht .schema_name
32
+ JOIN _timescaledb_catalog .hypertable ht ON relname = ht .table_name AND nspname = ht .schema_name
33
33
),
34
34
table_summary AS (
35
- SELECT format(' %I.%I' , ht1 .schema_name , ht1 .table_name ) AS hypertable_name,
36
- format(' %I.%I' , ht2 .schema_name , ht2 .table_name ) AS compressed_hypertable_name,
37
- format(' %I.%I' , ch2 .schema_name , ch2 .table_name ) AS compressed_chunk_name
38
- FROM hypertables ht1
39
- JOIN hypertables ht2 ON ht1 .compressed_hypertable_id = ht2 .hypertable_id
35
+ SELECT format(' %I.%I' , ht1 .schema_name , ht1 .table_name ) AS hypertable_name,
36
+ format(' %I.%I' , ht2 .schema_name , ht2 .table_name ) AS compressed_hypertable_name,
37
+ format(' %I.%I' , ch2 .schema_name , ch2 .table_name ) AS compressed_chunk_name
38
+ FROM hypertables ht1
39
+ JOIN hypertables ht2 ON ht1 .compressed_hypertable_id = ht2 .hypertable_id
40
40
JOIN _timescaledb_catalog .chunk ch2 ON ch2 .hypertable_id = ht2 .hypertable_id
41
41
)
42
42
SELECT hypertable_name,
@@ -49,3 +49,19 @@ SELECT hypertable_name,
49
49
ORDER BY hypertable_name, compressed_hypertable_name, compressed_chunk_name;
50
50
\x off
51
51
52
+ DO $$
53
+ DECLARE
54
+ ts_minor int := (SELECT (string_to_array(extversion,' .' ))[2 ]::int FROM pg_extension WHERE extname = ' timescaledb' );
55
+ BEGIN
56
+
57
+ -- Enable chunk skipping. For versions smaller than minor 18 we do
58
+ -- this in the post step since the feature and settings aren't all
59
+ -- available in proior versions.
60
+ IF ts_minor < 18 THEN
61
+ SET timescaledb .enable_chunk_skipping = true;
62
+ PERFORM enable_chunk_skipping(' compress' , ' some_int' );
63
+ END IF;
64
+ END
65
+ $$;
66
+
67
+ SELECT * FROM _timescaledb_catalog .chunk_column_stats ORDER BY id;
0 commit comments