-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathappend-16.out
More file actions
2002 lines (1893 loc) · 126 KB
/
Copy pathappend-16.out
File metadata and controls
2002 lines (1893 loc) · 126 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
\set TEST_BASE_NAME append
SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') as "TEST_LOAD_NAME",
format('include/%s_query.sql', :'TEST_BASE_NAME') as "TEST_QUERY_NAME",
format('%s/results/%s_results_optimized.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_OPTIMIZED",
format('%s/results/%s_results_unoptimized.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_UNOPTIMIZED"
\gset
SELECT format('\! diff -u --label "Unoptimized results" --label "Optimized results" %s %s', :'TEST_RESULTS_UNOPTIMIZED', :'TEST_RESULTS_OPTIMIZED') as "DIFF_CMD"
\gset
SET timescaledb.enable_now_constify TO false;
-- disable memoize node to avoid flaky results
SET enable_memoize TO 'off';
-- disable index only scans to avoid some flaky results
SET enable_indexonlyscan TO FALSE;
\set PREFIX 'EXPLAIN (analyze, buffers off, costs off, timing off, summary off)'
\ir :TEST_LOAD_NAME
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
-- create a now() function for repeatable testing that always returns
-- the same timestamp. It needs to be marked STABLE
CREATE OR REPLACE FUNCTION now_s()
RETURNS timestamptz LANGUAGE PLPGSQL STABLE PARALLEL SAFE AS
$BODY$
BEGIN
RAISE NOTICE 'Stable function now_s() called!';
RETURN '2017-08-22T10:00:00'::timestamptz;
END;
$BODY$;
CREATE OR REPLACE FUNCTION now_i()
RETURNS timestamptz LANGUAGE PLPGSQL IMMUTABLE AS
$BODY$
BEGIN
RAISE NOTICE 'Immutable function now_i() called!';
RETURN '2017-08-22T10:00:00'::timestamptz;
END;
$BODY$;
CREATE OR REPLACE FUNCTION now_v()
RETURNS timestamptz LANGUAGE PLPGSQL VOLATILE AS
$BODY$
BEGIN
RAISE NOTICE 'Volatile function now_v() called!';
RETURN '2017-08-22T10:00:00'::timestamptz;
END;
$BODY$;
CREATE OR REPLACE PROCEDURE force_parallel(on_or_off bool)
LANGUAGE PLPGSQL AS
$$
BEGIN
IF current_setting('server_version_num')::int < 160000 THEN
IF on_or_off THEN
set force_parallel_mode = 'on';
ELSE
set force_parallel_mode = 'off';
END IF;
ELSE
IF on_or_off THEN
set debug_parallel_query = 'on';
ELSE
set debug_parallel_query = 'off';
END IF;
END IF;
END;
$$;
CREATE TABLE append_test(time timestamptz, temp float, colorid integer, attr jsonb);
SELECT create_hypertable('append_test', 'time', chunk_time_interval => 2628000000000);
create_hypertable
--------------------------
(1,public,append_test,t)
-- create three chunks
INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2}'),
('2017-03-22T09:18:23', 21.5, 1, '{"a": 1, "b": 2}'),
('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'),
('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'),
('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}');
VACUUM (ANALYZE) append_test;
-- Create another hypertable to join with
CREATE TABLE join_test(time timestamptz, temp float, colorid integer);
SELECT create_hypertable('join_test', 'time', chunk_time_interval => 2628000000000);
create_hypertable
------------------------
(2,public,join_test,t)
INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1),
('2017-02-22T09:18:22', 24.5, 2),
('2017-08-22T09:18:22', 23.1, 3);
VACUUM (ANALYZE) join_test;
-- Create another table to join with which is not a hypertable.
CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb);
INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'),
('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'),
('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}');
VACUUM (ANALYZE) join_test_plain;
-- create hypertable with DATE time dimension
CREATE TABLE metrics_date(time DATE NOT NULL);
SELECT create_hypertable('metrics_date','time');
create_hypertable
---------------------------
(3,public,metrics_date,t)
INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval);
VACUUM (ANALYZE) metrics_date;
-- create hypertable with TIMESTAMP time dimension
CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL);
SELECT create_hypertable('metrics_timestamp','time');
psql:include/append_load.sql:91: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices
create_hypertable
--------------------------------
(4,public,metrics_timestamp,t)
INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval);
VACUUM (ANALYZE) metrics_timestamp;
-- create hypertable with TIMESTAMPTZ time dimension
CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL);
CREATE INDEX ON metrics_timestamptz(device_id,time);
SELECT create_hypertable('metrics_timestamptz','time');
create_hypertable
----------------------------------
(5,public,metrics_timestamptz,t)
INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1;
INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2;
INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3;
VACUUM (ANALYZE) metrics_timestamptz;
-- create space partitioned hypertable
CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text);
SELECT create_hypertable('metrics_space','time','device_id',3);
create_hypertable
----------------------------
(6,public,metrics_space,t)
INSERT INTO metrics_space
SELECT time, device_id, device_id + 0.25, device_id + 0.75, device_id
FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m'::interval) g1(time),
generate_series(1,10,1) g2(device_id)
ORDER BY time, device_id;
VACUUM (ANALYZE) metrics_space;
-- test ChunkAppend projection #2661
CREATE TABLE i2661 (
machine_id int4 NOT NULL,
"name" varchar(255) NOT NULL,
"timestamp" timestamptz NOT NULL,
"first" float4 NULL
);
SELECT create_hypertable('i2661', 'timestamp');
psql:include/append_load.sql:123: WARNING: column type "character varying" used for "name" does not follow best practices
create_hypertable
--------------------
(7,public,i2661,t)
INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0;
VACUUM (ANALYZE) i2661;
\ir :TEST_QUERY_NAME
-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
-- canary for results diff
-- this should be the only output of the results diff
SELECT setting, current_setting(setting) AS value from (VALUES ('timescaledb.enable_optimizations'),('timescaledb.enable_chunk_append')) v(setting);
setting | value
----------------------------------+-------
timescaledb.enable_optimizations | on
timescaledb.enable_chunk_append | on
-- query should exclude all chunks with optimization on
:PREFIX
SELECT * FROM append_test WHERE time > now_s() + '1 month'
ORDER BY time DESC;
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:12: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Sort (actual rows=0.00 loops=1)
Sort Key: append_test."time" DESC
Sort Method: quicksort
-> Custom Scan (ChunkAppend) on append_test (actual rows=0.00 loops=1)
Chunks excluded during startup: 3
--query should exclude all chunks and be a MergeAppend
:PREFIX
SELECT * FROM append_test WHERE time > now_s() + '1 month'
ORDER BY time DESC limit 1;
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:17: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Limit (actual rows=0.00 loops=1)
-> Custom Scan (ChunkAppend) on append_test (actual rows=0.00 loops=1)
Order: append_test."time" DESC
Chunks excluded during startup: 3
-- when optimized, the plan should be a constraint-aware append and
-- cover only one chunk. It should be a backward index scan due to
-- descending index on time. Should also skip the main table, since it
-- cannot hold tuples
:PREFIX
SELECT * FROM append_test WHERE time > now_s() - interval '2 months';
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:24: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on append_test (actual rows=1.00 loops=1)
Chunks excluded during startup: 2
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ("time" > (now_s() - '@ 2 mons'::interval))
-- adding ORDER BY and LIMIT should turn the plan into an optimized
-- ordered append plan
:PREFIX
SELECT * FROM append_test WHERE time > now_s() - interval '2 months'
ORDER BY time LIMIT 3;
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:30: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Limit (actual rows=1.00 loops=1)
-> Sort (actual rows=1.00 loops=1)
Sort Key: append_test."time"
Sort Method: quicksort
-> Custom Scan (ChunkAppend) on append_test (actual rows=1.00 loops=1)
Chunks excluded during startup: 2
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ("time" > (now_s() - '@ 2 mons'::interval))
-- no optimized plan for queries with restrictions that can be
-- constified at planning time. Regular planning-time constraint
-- exclusion should occur.
:PREFIX
SELECT * FROM append_test WHERE time > now_i() - interval '2 months'
ORDER BY time;
psql:include/append_query.sql:37: NOTICE: Immutable function now_i() called!
--- QUERY PLAN ---
Sort (actual rows=1.00 loops=1)
Sort Key: append_test."time"
Sort Method: quicksort
-> Custom Scan (ChunkAppend) on append_test (actual rows=1.00 loops=1)
Chunks excluded during startup: 2
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval))
-- currently, we cannot distinguish between stable and volatile
-- functions as far as applying our modified plan. However, volatile
-- function should not be pre-evaluated to constants, so no chunk
-- exclusion should occur.
:PREFIX
SELECT * FROM append_test WHERE time > now_v() - interval '2 months'
ORDER BY time;
psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called!
psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called!
psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called!
psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called!
psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called!
--- QUERY PLAN ---
Sort (actual rows=1.00 loops=1)
Sort Key: append_test."time"
Sort Method: quicksort
-> Custom Scan (ChunkAppend) on append_test (actual rows=1.00 loops=1)
Chunks excluded during startup: 0
-> Seq Scan on _hyper_1_1_chunk (actual rows=0.00 loops=1)
Filter: ("time" > (now_v() - '@ 2 mons'::interval))
Rows Removed by Filter: 2
-> Seq Scan on _hyper_1_2_chunk (actual rows=0.00 loops=1)
Filter: ("time" > (now_v() - '@ 2 mons'::interval))
Rows Removed by Filter: 2
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ("time" > (now_v() - '@ 2 mons'::interval))
-- prepared statement output should be the same regardless of
-- optimizations
PREPARE query_opt AS
SELECT * FROM append_test WHERE time > now_s() - interval '2 months'
ORDER BY time;
:PREFIX EXECUTE query_opt;
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:53: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Sort (actual rows=1.00 loops=1)
Sort Key: append_test."time"
Sort Method: quicksort
-> Custom Scan (ChunkAppend) on append_test (actual rows=1.00 loops=1)
Chunks excluded during startup: 2
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ("time" > (now_s() - '@ 2 mons'::interval))
DEALLOCATE query_opt;
-- aggregates should produce same output
:PREFIX
SELECT date_trunc('year', time) t, avg(temp) FROM append_test
WHERE time > now_s() - interval '4 months'
GROUP BY t
ORDER BY t DESC;
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:62: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
GroupAggregate (actual rows=1.00 loops=1)
Group Key: (date_trunc('year'::text, append_test."time"))
-> Sort (actual rows=3.00 loops=1)
Sort Key: (date_trunc('year'::text, append_test."time")) DESC
Sort Method: quicksort
-> Result (actual rows=3.00 loops=1)
-> Custom Scan (ChunkAppend) on append_test (actual rows=3.00 loops=1)
Chunks excluded during startup: 1
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ("time" > (now_s() - '@ 4 mons'::interval))
-> Seq Scan on _hyper_1_2_chunk (actual rows=2.00 loops=1)
Filter: ("time" > (now_s() - '@ 4 mons'::interval))
-- querying outside the time range should return nothing. This tests
-- that ConstraintAwareAppend can handle the case when an Append node
-- is turned into a Result node due to no children
:PREFIX
SELECT date_trunc('year', time) t, avg(temp)
FROM append_test
WHERE time < '2016-03-22'
AND date_part('dow', time) between 1 and 5
GROUP BY t
ORDER BY t DESC;
--- QUERY PLAN ---
GroupAggregate (actual rows=0.00 loops=1)
Group Key: (date_trunc('year'::text, "time"))
-> Sort (actual rows=0.00 loops=1)
Sort Key: (date_trunc('year'::text, "time")) DESC
Sort Method: quicksort
-> Result (actual rows=0.00 loops=1)
One-Time Filter: false
-- a parameterized query can safely constify params, so won't be
-- optimized by constraint-aware append since regular constraint
-- exclusion works just fine
PREPARE query_param AS
SELECT * FROM append_test WHERE time > $1 ORDER BY time;
:PREFIX
EXECUTE query_param(now_s() - interval '2 months');
psql:include/append_query.sql:82: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Sort (actual rows=1.00 loops=1)
Sort Key: _hyper_1_3_chunk."time"
Sort Method: quicksort
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
DEALLOCATE query_param;
--test with cte
:PREFIX
WITH data AS (
SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE
FROM append_test
WHERE
TIME > now_s() - INTERVAL '400 day'
AND colorid > 0
GROUP BY btime
),
period AS (
SELECT time_bucket(INTERVAL '30 day', TIME) AS btime
FROM GENERATE_SERIES('2017-03-22T01:01:01', '2017-08-23T01:01:01', INTERVAL '30 day') TIME
)
SELECT period.btime, VALUE
FROM period
LEFT JOIN DATA USING (btime)
ORDER BY period.btime;
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:102: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Sort (actual rows=6.00 loops=1)
Sort Key: (time_bucket('@ 30 days'::interval, "time"."time"))
Sort Method: quicksort
-> Hash Left Join (actual rows=6.00 loops=1)
Hash Cond: (time_bucket('@ 30 days'::interval, "time"."time") = data.btime)
-> Function Scan on generate_series "time" (actual rows=6.00 loops=1)
-> Hash (actual rows=3.00 loops=1)
-> Subquery Scan on data (actual rows=3.00 loops=1)
-> HashAggregate (actual rows=3.00 loops=1)
Group Key: time_bucket('@ 30 days'::interval, append_test."time")
-> Result (actual rows=5.00 loops=1)
-> Custom Scan (ChunkAppend) on append_test (actual rows=5.00 loops=1)
Chunks excluded during startup: 0
-> Seq Scan on _hyper_1_1_chunk (actual rows=2.00 loops=1)
Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval)))
-> Seq Scan on _hyper_1_2_chunk (actual rows=2.00 loops=1)
Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval)))
-> Seq Scan on _hyper_1_3_chunk (actual rows=1.00 loops=1)
Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval)))
WITH data AS (
SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE
FROM append_test
WHERE
TIME > now_s() - INTERVAL '400 day'
AND colorid > 0
GROUP BY btime
),
period AS (
SELECT time_bucket(INTERVAL '30 day', TIME) AS btime
FROM GENERATE_SERIES('2017-03-22T01:01:01', '2017-08-23T01:01:01', INTERVAL '30 day') TIME
)
SELECT period.btime, VALUE
FROM period
LEFT JOIN DATA USING (btime)
ORDER BY period.btime;
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:119: NOTICE: Stable function now_s() called!
btime | value
------------------------------+-------
Fri Mar 03 16:00:00 2017 PST | 22.5
Sun Apr 02 17:00:00 2017 PDT |
Tue May 02 17:00:00 2017 PDT | 25.7
Thu Jun 01 17:00:00 2017 PDT |
Sat Jul 01 17:00:00 2017 PDT |
Mon Jul 31 17:00:00 2017 PDT | 34.1
-- force nested loop join with no materialization. This tests that the
-- inner ConstraintAwareScan supports resetting its scan for every
-- iteration of the outer relation loop
set enable_hashjoin = 'off';
set enable_mergejoin = 'off';
set enable_material = 'off';
:PREFIX
SELECT * FROM append_test a INNER JOIN join_test j ON (a.colorid = j.colorid)
WHERE a.time > now_s() - interval '3 hours' AND j.time > now_s() - interval '3 hours';
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
psql:include/append_query.sql:130: NOTICE: Stable function now_s() called!
--- QUERY PLAN ---
Nested Loop (actual rows=1.00 loops=1)
Join Filter: (a.colorid = j.colorid)
-> Custom Scan (ChunkAppend) on append_test a (actual rows=1.00 loops=1)
Chunks excluded during startup: 2
-> Seq Scan on _hyper_1_3_chunk a_1 (actual rows=1.00 loops=1)
Filter: ("time" > (now_s() - '@ 3 hours'::interval))
-> Custom Scan (ChunkAppend) on join_test j (actual rows=1.00 loops=1)
Chunks excluded during startup: 2
-> Seq Scan on _hyper_2_6_chunk j_1 (actual rows=1.00 loops=1)
Filter: ("time" > (now_s() - '@ 3 hours'::interval))
reset enable_hashjoin;
reset enable_mergejoin;
reset enable_material;
-- test constraint_exclusion with date time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints
-- the queries should all have 3 chunks
:PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=4609.00 loops=1)
Order: metrics_date."time"
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=4609.00 loops=1)
Order: metrics_date."time"
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=4609.00 loops=1)
Order: metrics_date."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-- test Const OP Var
-- the queries should all have 3 chunks
:PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::date < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=4609.00 loops=1)
Order: metrics_date."time"
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamp < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=4609.00 loops=1)
Order: metrics_date."time"
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamptz < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=4609.00 loops=1)
Order: metrics_date."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-- test 2 constraints
-- the queries should all have 2 chunks
:PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::date AND time < '2000-01-21'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=1440.00 loops=1)
Order: metrics_date."time"
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date))
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288.00 loops=1)
Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date))
:PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=1440.00 loops=1)
Order: metrics_date."time"
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone))
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone))
:PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_date (actual rows=1440.00 loops=1)
Order: metrics_date."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-> Index Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-> Index Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-- test constraint_exclusion with timestamp time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints
-- the queries should all have 3 chunks
:PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=4896.00 loops=1)
Order: metrics_timestamp."time"
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=4896.00 loops=1)
Order: metrics_timestamp."time"
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=4896.00 loops=1)
Order: metrics_timestamp."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-- test Const OP Var
-- the queries should all have 3 chunks
:PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::date < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=4896.00 loops=1)
Order: metrics_timestamp."time"
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamp < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=4896.00 loops=1)
Order: metrics_timestamp."time"
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016.00 loops=1)
-> Index Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441.00 loops=1)
:PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamptz < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=4896.00 loops=1)
Order: metrics_timestamp."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-- test 2 constraints
-- the queries should all have 2 chunks
:PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::date AND time < '2000-01-21'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=1727.00 loops=1)
Order: metrics_timestamp."time"
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date))
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288.00 loops=1)
Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date))
:PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=1727.00 loops=1)
Order: metrics_timestamp."time"
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone))
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone))
:PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamp (actual rows=1727.00 loops=1)
Order: metrics_timestamp."time"
Chunks excluded during startup: 3
-> Index Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-> Index Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-- test constraint_exclusion with timestamptz time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints
-- the queries should all have 3 chunks
:PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=14688.00 loops=1)
Order: metrics_timestamptz."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
:PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=14688.00 loops=1)
Order: metrics_timestamptz."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
:PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=14688.00 loops=1)
Order: metrics_timestamptz."time"
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048.00 loops=1)
-> Index Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611.00 loops=1)
-- test Const OP Var
-- the queries should all have 3 chunks
:PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::date < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=14688.00 loops=1)
Order: metrics_timestamptz."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
-> Index Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611.00 loops=1)
Index Cond: ("time" > '01-15-2000'::date)
:PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamp < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=14688.00 loops=1)
Order: metrics_timestamptz."time"
Chunks excluded during startup: 2
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)
:PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamptz < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=14688.00 loops=1)
Order: metrics_timestamptz."time"
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048.00 loops=1)
-> Index Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611.00 loops=1)
-- test 2 constraints
-- the queries should all have 2 chunks
:PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::date AND time < '2000-01-21'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=5181.00 loops=1)
Order: metrics_timestamptz."time"
Chunks excluded during startup: 3
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date))
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152.00 loops=1)
Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date))
:PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=5181.00 loops=1)
Order: metrics_timestamptz."time"
Chunks excluded during startup: 3
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone))
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone))
:PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=5181.00 loops=1)
Order: metrics_timestamptz."time"
-> Index Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-> Index Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152.00 loops=1)
Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone))
-- test constraint_exclusion with space partitioning and DATE/TIMESTAMP/TIMESTAMPTZ constraints
-- exclusion for constraints with non-matching datatypes not working for space partitioning atm
:PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_22_chunk_metrics_space_time_idx on _hyper_6_22_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_23_chunk_metrics_space_time_idx on _hyper_6_23_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_24_chunk_metrics_space_time_idx on _hyper_6_24_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
:PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_22_chunk_metrics_space_time_idx on _hyper_6_22_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_23_chunk_metrics_space_time_idx on _hyper_6_23_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_24_chunk_metrics_space_time_idx on _hyper_6_24_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
:PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-- test Const OP Var
-- exclusion for constraints with non-matching datatypes not working for space partitioning atm
:PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::date < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_22_chunk_metrics_space_time_idx on _hyper_6_22_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_23_chunk_metrics_space_time_idx on _hyper_6_23_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_24_chunk_metrics_space_time_idx on _hyper_6_24_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: ("time" > '01-10-2000'::date)
:PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamp < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_22_chunk_metrics_space_time_idx on _hyper_6_22_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_23_chunk_metrics_space_time_idx on _hyper_6_23_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_24_chunk_metrics_space_time_idx on _hyper_6_24_chunk (actual rows=0.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone)
:PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamptz < time ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)
-- test 2 constraints
-- exclusion for constraints with non-matching datatypes not working for space partitioning atm
:PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::date AND time < '2000-01-15'::date ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_22_chunk_metrics_space_time_idx on _hyper_6_22_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Index Scan Backward using _hyper_6_23_chunk_metrics_space_time_idx on _hyper_6_23_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Index Scan Backward using _hyper_6_24_chunk_metrics_space_time_idx on _hyper_6_24_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Merge Append (actual rows=7670.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Index Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Merge Append (actual rows=3850.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
-> Index Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770.00 loops=1)
Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date))
:PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp AND time < '2000-01-15'::timestamp ORDER BY time;
--- QUERY PLAN ---
Custom Scan (ChunkAppend) on metrics_space (actual rows=11520.00 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=0.00 loops=1)
Sort Key: metrics_space."time"
-> Index Scan Backward using _hyper_6_22_chunk_metrics_space_time_idx on _hyper_6_22_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone))
-> Index Scan Backward using _hyper_6_23_chunk_metrics_space_time_idx on _hyper_6_23_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone))
-> Index Scan Backward using _hyper_6_24_chunk_metrics_space_time_idx on _hyper_6_24_chunk (actual rows=0.00 loops=1)
Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone))