-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathcompress_compbloom_manual_config.out
More file actions
253 lines (237 loc) · 11.5 KB
/
Copy pathcompress_compbloom_manual_config.out
File metadata and controls
253 lines (237 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
-- 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.
---------------------------------------------------------------------
-- Manual config change between chunk compressions
---------------------------------------------------------------------
CREATE TABLE mixed_avail_manual(ts timestamptz, a int, b int, c int, seg int);
SELECT create_hypertable('mixed_avail_manual', by_range('ts', interval '1 day'));
create_hypertable
-------------------
(1,t)
-- Initial config: bloom(a,b)
ALTER TABLE mixed_avail_manual SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'seg',
timescaledb.compress_orderby = 'ts',
timescaledb.compress_index = 'bloom(a,b)'
);
INSERT INTO mixed_avail_manual
SELECT ts, (i % 10), (i % 5), (i % 3), 1
FROM generate_series('2024-01-01'::timestamptz, '2024-01-03', interval '1 hour') ts,
generate_series(1, 100) i;
-- Compress first chunk with bloom(a,b)
SELECT compress_chunk(c) FROM show_chunks('mixed_avail_manual') c LIMIT 1;
compress_chunk
----------------------------------------
_timescaledb_internal._hyper_1_1_chunk
SELECT COUNT(*) FROM mixed_avail_manual WHERE a = 1 AND b = 2;
count
-------
0
SELECT COUNT(*) FROM mixed_avail_manual WHERE a = 1 AND c = 2;
count
-------
147
SELECT COUNT(*) FROM mixed_avail_manual WHERE b = 1 AND c = 2;
count
-------
294
-- Before config changes
EXPLAIN (ANALYZE, BUFFERS OFF, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT * FROM mixed_avail_manual WHERE a = 1 AND b = 2
ORDER BY 1,2,3,4;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on mixed_avail_manual (actual rows=0.00 loops=1)
Order: mixed_avail_manual.ts, mixed_avail_manual.c
-> Sort (actual rows=0.00 loops=1)
Sort Key: _hyper_1_1_chunk.ts, _hyper_1_1_chunk.c
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
Vectorized Filter: ((a = 1) AND (b = 2))
-> Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
Filter: _timescaledb_functions.bloom1_contains_any_hashes(regress-test-bloom_7035_a_b, TEST-HASHES::bigint[])
Rows Removed by Filter: 2
-> Sort (actual rows=0.00 loops=1)
Sort Key: _hyper_1_2_chunk.ts, _hyper_1_2_chunk.c
Sort Method: quicksort
-> Seq Scan on _hyper_1_2_chunk (actual rows=0.00 loops=1)
Filter: ((a = 1) AND (b = 2))
Rows Removed by Filter: 2400
-> Sort (actual rows=0.00 loops=1)
Sort Key: _hyper_1_3_chunk.ts, _hyper_1_3_chunk.c
Sort Method: quicksort
-> Seq Scan on _hyper_1_3_chunk (actual rows=0.00 loops=1)
Filter: ((a = 1) AND (b = 2))
Rows Removed by Filter: 900
EXPLAIN (ANALYZE, BUFFERS OFF, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT * FROM mixed_avail_manual WHERE a = 1 AND c = 2
ORDER BY 1,2,3,4;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on mixed_avail_manual (actual rows=147.00 loops=1)
Order: mixed_avail_manual.ts, mixed_avail_manual.b
-> Sort (actual rows=48.00 loops=1)
Sort Key: _hyper_1_1_chunk.ts, _hyper_1_1_chunk.b
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=48.00 loops=1)
Vectorized Filter: ((a = 1) AND (c = 2))
Rows Removed by Filter: 1552
-> Seq Scan on compress_hyper_2_4_chunk (actual rows=2.00 loops=1)
-> Sort (actual rows=72.00 loops=1)
Sort Key: _hyper_1_2_chunk.ts, _hyper_1_2_chunk.b
Sort Method: quicksort
-> Seq Scan on _hyper_1_2_chunk (actual rows=72.00 loops=1)
Filter: ((a = 1) AND (c = 2))
Rows Removed by Filter: 2328
-> Sort (actual rows=27.00 loops=1)
Sort Key: _hyper_1_3_chunk.ts, _hyper_1_3_chunk.b
Sort Method: quicksort
-> Seq Scan on _hyper_1_3_chunk (actual rows=27.00 loops=1)
Filter: ((a = 1) AND (c = 2))
Rows Removed by Filter: 873
EXPLAIN (ANALYZE, BUFFERS OFF, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT * FROM mixed_avail_manual WHERE b = 1 AND c = 2
ORDER BY 1,2,3,4;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on mixed_avail_manual (actual rows=294.00 loops=1)
Order: mixed_avail_manual.ts, mixed_avail_manual.a
-> Sort (actual rows=96.00 loops=1)
Sort Key: _hyper_1_1_chunk.ts, _hyper_1_1_chunk.a
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=96.00 loops=1)
Vectorized Filter: ((b = 1) AND (c = 2))
Rows Removed by Filter: 1504
-> Seq Scan on compress_hyper_2_4_chunk (actual rows=2.00 loops=1)
-> Sort (actual rows=144.00 loops=1)
Sort Key: _hyper_1_2_chunk.ts, _hyper_1_2_chunk.a
Sort Method: quicksort
-> Seq Scan on _hyper_1_2_chunk (actual rows=144.00 loops=1)
Filter: ((b = 1) AND (c = 2))
Rows Removed by Filter: 2256
-> Sort (actual rows=54.00 loops=1)
Sort Key: _hyper_1_3_chunk.ts, _hyper_1_3_chunk.a
Sort Method: quicksort
-> Seq Scan on _hyper_1_3_chunk (actual rows=54.00 loops=1)
Filter: ((b = 1) AND (c = 2))
Rows Removed by Filter: 846
-- Change config: bloom(a,c)
ALTER TABLE mixed_avail_manual SET (
timescaledb.compress_index = 'bloom(a,c)'
);
NOTICE: updated compression settings will only apply to future compressions
-- Compress second chunk with bloom(a,c)
SELECT compress_chunk(c) FROM show_chunks('mixed_avail_manual') c OFFSET 1 LIMIT 1;
NOTICE: chunk "_hyper_1_1_chunk" is already converted to columnstore
compress_chunk
----------------------------------------
_timescaledb_internal._hyper_1_2_chunk
-- Change config: bloom(b,c)
ALTER TABLE mixed_avail_manual SET (
timescaledb.compress_index = 'bloom(b,c)'
);
NOTICE: updated compression settings will only apply to future compressions
-- Compress third chunk with bloom(b,c)
SELECT compress_chunk(c) FROM show_chunks('mixed_avail_manual') c OFFSET 2;
NOTICE: chunk "_hyper_1_1_chunk" is already converted to columnstore
NOTICE: chunk "_hyper_1_2_chunk" is already converted to columnstore
compress_chunk
----------------------------------------
_timescaledb_internal._hyper_1_3_chunk
SELECT COUNT(*) FROM mixed_avail_manual WHERE a = 1 AND b = 2;
count
-------
0
SELECT COUNT(*) FROM mixed_avail_manual WHERE a = 1 AND c = 2;
count
-------
147
SELECT COUNT(*) FROM mixed_avail_manual WHERE b = 1 AND c = 2;
count
-------
294
-- After config changes
EXPLAIN (ANALYZE, BUFFERS OFF, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT * FROM mixed_avail_manual WHERE a = 1 AND b = 2
ORDER BY 1,2,3,4;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on mixed_avail_manual (actual rows=0.00 loops=1)
Order: mixed_avail_manual.ts, mixed_avail_manual.c
-> Sort (actual rows=0.00 loops=1)
Sort Key: _hyper_1_1_chunk.ts, _hyper_1_1_chunk.c
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=0.00 loops=1)
Vectorized Filter: ((a = 1) AND (b = 2))
-> Seq Scan on compress_hyper_2_4_chunk (actual rows=0.00 loops=1)
Filter: _timescaledb_functions.bloom1_contains_any_hashes(regress-test-bloom_7035_a_b, TEST-HASHES::bigint[])
Rows Removed by Filter: 2
-> Sort (actual rows=0.00 loops=1)
Sort Key: _hyper_1_2_chunk.ts, _hyper_1_2_chunk.c
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=0.00 loops=1)
Vectorized Filter: ((a = 1) AND (b = 2))
Rows Removed by Filter: 2400
-> Seq Scan on compress_hyper_2_5_chunk (actual rows=3.00 loops=1)
-> Sort (actual rows=0.00 loops=1)
Sort Key: _hyper_1_3_chunk.ts, _hyper_1_3_chunk.c
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_3_chunk (actual rows=0.00 loops=1)
Vectorized Filter: ((a = 1) AND (b = 2))
Rows Removed by Filter: 900
-> Seq Scan on compress_hyper_2_6_chunk (actual rows=1.00 loops=1)
EXPLAIN (ANALYZE, BUFFERS OFF, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT * FROM mixed_avail_manual WHERE a = 1 AND c = 2
ORDER BY 1,2,3,4;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on mixed_avail_manual (actual rows=147.00 loops=1)
Order: mixed_avail_manual.ts, mixed_avail_manual.b
-> Sort (actual rows=48.00 loops=1)
Sort Key: _hyper_1_1_chunk.ts, _hyper_1_1_chunk.b
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=48.00 loops=1)
Vectorized Filter: ((a = 1) AND (c = 2))
Rows Removed by Filter: 1552
-> Seq Scan on compress_hyper_2_4_chunk (actual rows=2.00 loops=1)
-> Sort (actual rows=72.00 loops=1)
Sort Key: _hyper_1_2_chunk.ts, _hyper_1_2_chunk.b
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=72.00 loops=1)
Vectorized Filter: ((a = 1) AND (c = 2))
Rows Removed by Filter: 2328
-> Seq Scan on compress_hyper_2_5_chunk (actual rows=3.00 loops=1)
Filter: _timescaledb_functions.bloom1_contains_any_hashes(regress-test-bloom_e8f0_a_c, TEST-HASHES::bigint[])
-> Sort (actual rows=27.00 loops=1)
Sort Key: _hyper_1_3_chunk.ts, _hyper_1_3_chunk.b
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_3_chunk (actual rows=27.00 loops=1)
Vectorized Filter: ((a = 1) AND (c = 2))
Rows Removed by Filter: 873
-> Seq Scan on compress_hyper_2_6_chunk (actual rows=1.00 loops=1)
EXPLAIN (ANALYZE, BUFFERS OFF, COSTS OFF, TIMING OFF, SUMMARY OFF)
SELECT * FROM mixed_avail_manual WHERE b = 1 AND c = 2
ORDER BY 1,2,3,4;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on mixed_avail_manual (actual rows=294.00 loops=1)
Order: mixed_avail_manual.ts, mixed_avail_manual.a
-> Sort (actual rows=96.00 loops=1)
Sort Key: _hyper_1_1_chunk.ts, _hyper_1_1_chunk.a
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_1_chunk (actual rows=96.00 loops=1)
Vectorized Filter: ((b = 1) AND (c = 2))
Rows Removed by Filter: 1504
-> Seq Scan on compress_hyper_2_4_chunk (actual rows=2.00 loops=1)
-> Sort (actual rows=144.00 loops=1)
Sort Key: _hyper_1_2_chunk.ts, _hyper_1_2_chunk.a
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_2_chunk (actual rows=144.00 loops=1)
Vectorized Filter: ((b = 1) AND (c = 2))
Rows Removed by Filter: 2256
-> Seq Scan on compress_hyper_2_5_chunk (actual rows=3.00 loops=1)
-> Sort (actual rows=54.00 loops=1)
Sort Key: _hyper_1_3_chunk.ts, _hyper_1_3_chunk.a
Sort Method: quicksort
-> Custom Scan (ColumnarScan) on _hyper_1_3_chunk (actual rows=54.00 loops=1)
Vectorized Filter: ((b = 1) AND (c = 2))
Rows Removed by Filter: 846
-> Seq Scan on compress_hyper_2_6_chunk (actual rows=1.00 loops=1)
Filter: _timescaledb_functions.bloom1_contains_any_hashes(regress-test-bloom_7ba1_b_c, TEST-HASHES::bigint[])
DROP TABLE IF EXISTS mixed_avail_manual CASCADE;