timescaledb/tsl/test/shared/expected/constraint_exclusion_prepared.out
Sven Klemm b95e93a651 Run regresscheck-shared on PG13
This patch enables the regresscheck-shared testsuite to run on PG13
2021-02-10 12:59:39 +01:00

3099 lines
207 KiB
Plaintext

-- 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.
SELECT
format('include/%s.sql', :'TEST_BASE_NAME') as "TEST_QUERY_NAME",
format('%s/shared/results/%s_results_unoptimized.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_UNOPTIMIZED",
format('%s/shared/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_UNCOMPRESSED",
format('%s/shared/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') as "TEST_RESULTS_COMPRESSED"
\gset
SELECT format('\! diff -u --label "Uncompressed results" --label "Compressed results" %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') as "DIFF_CMD"
\gset
-- get EXPLAIN output for all variations
\set PREFIX 'EXPLAIN (analyze, costs off, timing off, summary off)'
\set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)'
set work_mem to '64MB';
-- disable incremental sort here to make plans comparable to PG < 13
SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 13 THEN set_config('enable_incremental_sort','off',false) ELSE 'off' END;
case
------
off
(1 row)
set max_parallel_workers_per_gather to 0;
\set TEST_TABLE 'metrics'
\ir :TEST_QUERY_NAME
-- 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.
-- test prepared statements
-- executor startup exclusion with no chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < now()
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 0
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 0
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 0
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 0
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 0
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < now()))
Heap Fetches: 0
(13 rows)
DEALLOCATE prep;
-- executor startup exclusion with chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ((device_id = 1) AND ("time" < ('2000-01-10'::cstring)::timestamp with time zone))
Heap Fetches: 0
(10 rows)
DEALLOCATE prep;
-- runtime exclusion with LATERAL and 2 hypertables
SET enable_seqscan TO false;
PREPARE prep AS
SELECT m1.time,
m2.time
FROM :TEST_TABLE m1
LEFT JOIN LATERAL (
SELECT time
FROM :TEST_TABLE m2
WHERE m1.time = m2.time
LIMIT 1) m2 ON TRUE
WHERE device_id = 2
ORDER BY m1.time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Index Only Scan using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_1_3_chunk_metrics_time_idx on _hyper_1_3_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(25 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Index Only Scan using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_1_3_chunk_metrics_time_idx on _hyper_1_3_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(25 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Index Only Scan using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_1_3_chunk_metrics_time_idx on _hyper_1_3_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(25 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Index Only Scan using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_1_3_chunk_metrics_time_idx on _hyper_1_3_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(25 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_device_id_time_idx on _hyper_1_1_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_device_id_time_idx on _hyper_1_2_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan Backward using _hyper_1_3_chunk_metrics_device_id_time_idx on _hyper_1_3_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Index Only Scan using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_1_3_chunk_metrics_time_idx on _hyper_1_3_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(25 rows)
DEALLOCATE prep;
RESET enable_seqscan;
-- executor startup exclusion with subquery
PREPARE prep AS
SELECT time
FROM (
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics (actual rows=100 loops=1)
Order: metrics."time"
Chunks excluded during startup: 1
-> Index Only Scan Backward using _hyper_1_1_chunk_metrics_time_idx on _hyper_1_1_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(10 rows)
DEALLOCATE prep;
-- test constraint exclusion for subqueries with ConstraintAwareAppend
SET timescaledb.enable_chunk_append TO FALSE;
PREPARE prep AS
SELECT device_id,
time
FROM (
SELECT device_id,
time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY device_id,
time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics.device_id, metrics."time"
Sort Method: top-N heapsort
-> Custom Scan (ConstraintAwareAppend) (actual rows=33590 loops=1)
Hypertable: metrics
Chunks left after exclusion: 2
-> Append (actual rows=33590 loops=1)
-> Seq Scan on _hyper_1_1_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=15600 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics.device_id, metrics."time"
Sort Method: top-N heapsort
-> Custom Scan (ConstraintAwareAppend) (actual rows=33590 loops=1)
Hypertable: metrics
Chunks left after exclusion: 2
-> Append (actual rows=33590 loops=1)
-> Seq Scan on _hyper_1_1_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=15600 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics.device_id, metrics."time"
Sort Method: top-N heapsort
-> Custom Scan (ConstraintAwareAppend) (actual rows=33590 loops=1)
Hypertable: metrics
Chunks left after exclusion: 2
-> Append (actual rows=33590 loops=1)
-> Seq Scan on _hyper_1_1_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=15600 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics.device_id, metrics."time"
Sort Method: top-N heapsort
-> Custom Scan (ConstraintAwareAppend) (actual rows=33590 loops=1)
Hypertable: metrics
Chunks left after exclusion: 2
-> Append (actual rows=33590 loops=1)
-> Seq Scan on _hyper_1_1_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=15600 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics.device_id, metrics."time"
Sort Method: top-N heapsort
-> Custom Scan (ConstraintAwareAppend) (actual rows=33590 loops=1)
Hypertable: metrics
Chunks left after exclusion: 2
-> Append (actual rows=33590 loops=1)
-> Seq Scan on _hyper_1_1_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=15600 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
(12 rows)
DEALLOCATE prep;
RESET timescaledb.enable_chunk_append;
\set TEST_TABLE 'metrics_space'
\ir :TEST_QUERY_NAME
-- 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.
-- test prepared statements
-- executor startup exclusion with no chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < now()
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 0
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 0
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 0
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 0
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 0
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
-> Index Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < now())
Filter: (device_id = 1)
(13 rows)
DEALLOCATE prep;
-- executor startup exclusion with chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 1
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 1
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 1
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 1
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
(10 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
Chunks excluded during startup: 1
-> Index Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
-> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Filter: (device_id = 1)
(10 rows)
DEALLOCATE prep;
-- runtime exclusion with LATERAL and 2 hypertables
SET enable_seqscan TO false;
PREPARE prep AS
SELECT m1.time,
m2.time
FROM :TEST_TABLE m1
LEFT JOIN LATERAL (
SELECT time
FROM :TEST_TABLE m2
WHERE m1.time = m2.time
LIMIT 1) m2 ON TRUE
WHERE device_id = 2
ORDER BY m1.time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_device_id_time_idx on _hyper_2_11_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m2_5 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m2_6 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk m2_7 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk m2_8 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(43 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_device_id_time_idx on _hyper_2_11_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m2_5 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m2_6 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk m2_7 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk m2_8 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(43 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_device_id_time_idx on _hyper_2_11_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m2_5 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m2_6 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk m2_7 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk m2_8 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(43 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_device_id_time_idx on _hyper_2_11_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m2_5 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m2_6 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk m2_7 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk m2_8 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(43 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=100 loops=1)
Order: m1."time"
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk m1_1 (actual rows=100 loops=1)
Index Cond: (device_id = 2)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_device_id_time_idx on _hyper_2_11_chunk m1_3 (never executed)
Index Cond: (device_id = 2)
Heap Fetches: 0
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk m2_1 (actual rows=1 loops=100)
Index Cond: ("time" = m1."time")
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk m2_2 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk m2_3 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m2_5 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m2_6 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk m2_7 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk m2_8 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed)
Index Cond: ("time" = m1."time")
Heap Fetches: 0
(43 rows)
DEALLOCATE prep;
RESET enable_seqscan;
-- executor startup exclusion with subquery
PREPARE prep AS
SELECT time
FROM (
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk (actual rows=60 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 60
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Merge Append (never executed)
Sort Key: _hyper_2_7_chunk."time"
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Merge Append (never executed)
Sort Key: _hyper_2_10_chunk."time"
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(36 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk (actual rows=60 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 60
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Merge Append (never executed)
Sort Key: _hyper_2_7_chunk."time"
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Merge Append (never executed)
Sort Key: _hyper_2_10_chunk."time"
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(36 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk (actual rows=60 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 60
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Merge Append (never executed)
Sort Key: _hyper_2_7_chunk."time"
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Merge Append (never executed)
Sort Key: _hyper_2_10_chunk."time"
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(36 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk (actual rows=60 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 60
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Merge Append (never executed)
Sort Key: _hyper_2_7_chunk."time"
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Merge Append (never executed)
Sort Key: _hyper_2_10_chunk."time"
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(36 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space (actual rows=100 loops=1)
Order: metrics_space."time"
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_time_idx on _hyper_2_4_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_time_idx on _hyper_2_5_chunk (actual rows=60 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 60
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_time_idx on _hyper_2_6_chunk (actual rows=21 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 21
-> Merge Append (never executed)
Sort Key: _hyper_2_7_chunk."time"
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Merge Append (never executed)
Sort Key: _hyper_2_10_chunk."time"
-> Index Only Scan using _hyper_2_10_chunk_metrics_space_time_idx on _hyper_2_10_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_11_chunk_metrics_space_time_idx on _hyper_2_11_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
-> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (never executed)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 0
(36 rows)
DEALLOCATE prep;
-- test constraint exclusion for subqueries with ConstraintAwareAppend
SET timescaledb.enable_chunk_append TO FALSE;
PREPARE prep AS
SELECT device_id,
time
FROM (
SELECT device_id,
time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY device_id,
time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_device_id_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_device_id_time_idx on _hyper_2_6_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
(24 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_device_id_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_device_id_time_idx on _hyper_2_6_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
(24 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_device_id_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_device_id_time_idx on _hyper_2_6_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
(24 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_device_id_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_device_id_time_idx on _hyper_2_6_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
(24 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time"
-> Index Only Scan using _hyper_2_4_chunk_metrics_space_device_id_time_idx on _hyper_2_4_chunk (actual rows=100 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 100
-> Index Only Scan using _hyper_2_5_chunk_metrics_space_device_id_time_idx on _hyper_2_5_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_6_chunk_metrics_space_device_id_time_idx on _hyper_2_6_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
-> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1)
Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Heap Fetches: 1
(24 rows)
DEALLOCATE prep;
RESET timescaledb.enable_chunk_append;
\set TEST_TABLE 'metrics_compressed'
\ir :TEST_QUERY_NAME
-- 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.
-- test prepared statements
-- executor startup exclusion with no chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < now()
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 1)
(16 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 1)
(16 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 1)
(16 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 1)
(16 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk (never executed)
Filter: ("time" < now())
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 1)
(16 rows)
DEALLOCATE prep;
-- executor startup exclusion with chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
(12 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=100 loops=1)
Order: metrics_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 1)
(12 rows)
DEALLOCATE prep;
-- runtime exclusion with LATERAL and 2 hypertables
SET enable_seqscan TO false;
PREPARE prep AS
SELECT m1.time,
m2.time
FROM :TEST_TABLE m1
LEFT JOIN LATERAL (
SELECT time
FROM :TEST_TABLE m2
WHERE m1.time = m2.time
LIMIT 1) m2 ON TRUE
WHERE device_id = 2
ORDER BY m1.time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_4_18_chunk compress_hyper_4_18_chunk_1 (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_17_chunk compress_hyper_4_17_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_16_chunk compress_hyper_4_16_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(30 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_4_18_chunk compress_hyper_4_18_chunk_1 (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_17_chunk compress_hyper_4_17_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_16_chunk compress_hyper_4_16_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(30 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_4_18_chunk compress_hyper_4_18_chunk_1 (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_17_chunk compress_hyper_4_17_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_16_chunk compress_hyper_4_16_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(30 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_4_18_chunk compress_hyper_4_18_chunk_1 (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_17_chunk compress_hyper_4_17_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_16_chunk compress_hyper_4_16_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(30 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_4_18_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_18_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_4_17_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_17_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_4_16_chunk__compressed_hypertable_4_device_id__t on compress_hyper_4_16_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 2
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_4_18_chunk compress_hyper_4_18_chunk_1 (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_17_chunk compress_hyper_4_17_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_3_15_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_4_16_chunk compress_hyper_4_16_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(30 rows)
DEALLOCATE prep;
RESET enable_seqscan;
-- executor startup exclusion with subquery
PREPARE prep AS
SELECT time
FROM (
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=33590 loops=1)
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=15600 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 9590
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=33590 loops=1)
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=15600 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 9590
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=33590 loops=1)
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=15600 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 9590
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=33590 loops=1)
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=15600 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 9590
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(13 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=33590 loops=1)
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=17990 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=15600 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 9590
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(13 rows)
DEALLOCATE prep;
-- test constraint exclusion for subqueries with ConstraintAwareAppend
SET timescaledb.enable_chunk_append TO FALSE;
PREPARE prep AS
SELECT device_id,
time
FROM (
SELECT device_id,
time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY device_id,
time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_compressed
Chunks left after exclusion: 2
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_3_13_chunk.device_id, _hyper_3_13_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_18_chunk.device_id, compress_hyper_4_18_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_17_chunk.device_id, compress_hyper_4_17_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(18 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_compressed
Chunks left after exclusion: 2
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_3_13_chunk.device_id, _hyper_3_13_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_18_chunk.device_id, compress_hyper_4_18_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_17_chunk.device_id, compress_hyper_4_17_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(18 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_compressed
Chunks left after exclusion: 2
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_3_13_chunk.device_id, _hyper_3_13_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_18_chunk.device_id, compress_hyper_4_18_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_17_chunk.device_id, compress_hyper_4_17_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(18 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_compressed
Chunks left after exclusion: 2
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_3_13_chunk.device_id, _hyper_3_13_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_18_chunk.device_id, compress_hyper_4_18_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_17_chunk.device_id, compress_hyper_4_17_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(18 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_compressed
Chunks left after exclusion: 2
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_3_13_chunk.device_id, _hyper_3_13_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_3_13_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_18_chunk.device_id, compress_hyper_4_18_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_18_chunk (actual rows=20 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_3_14_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_4_17_chunk.device_id, compress_hyper_4_17_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_4_17_chunk (actual rows=30 loops=1)
(18 rows)
DEALLOCATE prep;
RESET timescaledb.enable_chunk_append;
\set TEST_TABLE 'metrics_space_compressed'
\ir :TEST_QUERY_NAME
-- 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.
-- test prepared statements
-- executor startup exclusion with no chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < now()
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_30_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: (device_id = 1)
(23 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_30_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: (device_id = 1)
(23 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_30_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: (device_id = 1)
(23 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_30_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: (device_id = 1)
(23 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 0
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < now())
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (never executed)
Filter: ("time" < now())
-> Sort (never executed)
Sort Key: compress_hyper_6_30_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: (device_id = 1)
(23 rows)
DEALLOCATE prep;
-- executor startup exclusion with chunks excluded
PREPARE prep AS
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
AND device_id = 1
ORDER BY time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
(17 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
(17 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
(17 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
(17 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=100 loops=1)
Order: metrics_space_compressed."time"
Chunks excluded during startup: 1
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
Filter: (device_id = 1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (never executed)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (never executed)
Sort Key: compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: (device_id = 1)
(17 rows)
DEALLOCATE prep;
-- runtime exclusion with LATERAL and 2 hypertables
SET enable_seqscan TO false;
PREPARE prep AS
SELECT m1.time,
m2.time
FROM :TEST_TABLE m1
LEFT JOIN LATERAL (
SELECT time
FROM :TEST_TABLE m2
WHERE m1.time = m2.time
LIMIT 1) m2 ON TRUE
WHERE device_id = 2
ORDER BY m1.time
LIMIT 100;
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_6_35_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_35_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_6_32_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_32_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_6_29_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_29_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_35_chunk compress_hyper_6_35_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_34_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk m2_4 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m2_5 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_32_chunk compress_hyper_6_32_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk m2_6 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_31_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk m2_7 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m2_8 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_29_chunk compress_hyper_6_29_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk m2_9 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_28_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(54 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_6_35_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_35_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_6_32_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_32_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_6_29_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_29_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_35_chunk compress_hyper_6_35_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_34_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk m2_4 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m2_5 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_32_chunk compress_hyper_6_32_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk m2_6 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_31_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk m2_7 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m2_8 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_29_chunk compress_hyper_6_29_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk m2_9 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_28_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(54 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_6_35_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_35_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_6_32_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_32_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_6_29_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_29_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_35_chunk compress_hyper_6_35_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_34_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk m2_4 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m2_5 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_32_chunk compress_hyper_6_32_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk m2_6 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_31_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk m2_7 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m2_8 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_29_chunk compress_hyper_6_29_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk m2_9 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_28_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(54 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_6_35_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_35_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_6_32_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_32_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_6_29_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_29_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_35_chunk compress_hyper_6_35_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_34_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk m2_4 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m2_5 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_32_chunk compress_hyper_6_32_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk m2_6 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_31_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk m2_7 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m2_8 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_29_chunk compress_hyper_6_29_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk m2_9 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_28_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(54 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Nested Loop Left Join (actual rows=100 loops=1)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1)
Order: m1."time"
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m1_1 (actual rows=100 loops=1)
-> Index Scan Backward using compress_hyper_6_35_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_35_chunk (actual rows=1 loops=1)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m1_2 (never executed)
-> Index Scan Backward using compress_hyper_6_32_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_32_chunk (never executed)
Index Cond: (device_id = 2)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m1_3 (never executed)
-> Index Scan Backward using compress_hyper_6_29_chunk__compressed_hypertable_6_device_id__t on compress_hyper_6_29_chunk (never executed)
Index Cond: (device_id = 2)
-> Limit (actual rows=1 loops=100)
-> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100)
Chunks excluded during runtime: 6
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk m2_1 (actual rows=1 loops=100)
Filter: (m1."time" = "time")
Rows Removed by Filter: 548
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=1 loops=100)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
Rows Removed by Filter: 3
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk m2_2 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_35_chunk compress_hyper_6_35_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk m2_3 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_34_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk m2_4 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_33_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk m2_5 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_32_chunk compress_hyper_6_32_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk m2_6 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_31_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk m2_7 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_30_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk m2_8 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_29_chunk compress_hyper_6_29_chunk_1 (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk m2_9 (never executed)
Filter: (m1."time" = "time")
-> Seq Scan on compress_hyper_6_28_chunk (never executed)
Filter: ((_ts_meta_min_1 <= m1."time") AND (_ts_meta_max_1 >= m1."time"))
(54 rows)
DEALLOCATE prep;
RESET enable_seqscan;
-- executor startup exclusion with subquery
PREPARE prep AS
SELECT time
FROM (
SELECT time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_space_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=33590 loops=1)
-> Merge Append (actual rows=17990 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=10794 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Merge Append (actual rows=15600 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=9360 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5754
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
-> Merge Append (actual rows=0 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_30_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 15114
-> Seq Scan on compress_hyper_6_29_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_28_chunk (actual rows=6 loops=1)
(41 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_space_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=33590 loops=1)
-> Merge Append (actual rows=17990 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=10794 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Merge Append (actual rows=15600 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=9360 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5754
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
-> Merge Append (actual rows=0 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_30_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 15114
-> Seq Scan on compress_hyper_6_29_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_28_chunk (actual rows=6 loops=1)
(41 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_space_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=33590 loops=1)
-> Merge Append (actual rows=17990 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=10794 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Merge Append (actual rows=15600 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=9360 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5754
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
-> Merge Append (actual rows=0 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_30_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 15114
-> Seq Scan on compress_hyper_6_29_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_28_chunk (actual rows=6 loops=1)
(41 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_space_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=33590 loops=1)
-> Merge Append (actual rows=17990 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=10794 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Merge Append (actual rows=15600 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=9360 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5754
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
-> Merge Append (actual rows=0 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_30_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 15114
-> Seq Scan on compress_hyper_6_29_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_28_chunk (actual rows=6 loops=1)
(41 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
--------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Sort (actual rows=100 loops=1)
Sort Key: metrics_space_compressed."time"
Sort Method: top-N heapsort
-> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=33590 loops=1)
-> Merge Append (actual rows=17990 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=10794 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=3598 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Merge Append (actual rows=15600 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=9360 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5754
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=3120 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 1918
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
-> Merge Append (actual rows=0 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_25_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_30_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_26_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 15114
-> Seq Scan on compress_hyper_6_29_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_27_chunk (actual rows=0 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
Rows Removed by Filter: 5038
-> Seq Scan on compress_hyper_6_28_chunk (actual rows=6 loops=1)
(41 rows)
DEALLOCATE prep;
-- test constraint exclusion for subqueries with ConstraintAwareAppend
SET timescaledb.enable_chunk_append TO FALSE;
PREPARE prep AS
SELECT device_id,
time
FROM (
SELECT device_id,
time
FROM :TEST_TABLE
WHERE time < '2000-01-10'::text::timestamptz
ORDER BY device_id,
time
LIMIT 100) m;
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space_compressed
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_5_19_chunk.device_id, _hyper_5_19_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk.device_id, compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_35_chunk.device_id, compress_hyper_6_35_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_34_chunk.device_id, compress_hyper_6_34_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_33_chunk.device_id, compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_32_chunk.device_id, compress_hyper_6_32_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_31_chunk.device_id, compress_hyper_6_31_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
(42 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space_compressed
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_5_19_chunk.device_id, _hyper_5_19_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk.device_id, compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_35_chunk.device_id, compress_hyper_6_35_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_34_chunk.device_id, compress_hyper_6_34_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_33_chunk.device_id, compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_32_chunk.device_id, compress_hyper_6_32_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_31_chunk.device_id, compress_hyper_6_31_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
(42 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space_compressed
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_5_19_chunk.device_id, _hyper_5_19_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk.device_id, compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_35_chunk.device_id, compress_hyper_6_35_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_34_chunk.device_id, compress_hyper_6_34_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_33_chunk.device_id, compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_32_chunk.device_id, compress_hyper_6_32_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_31_chunk.device_id, compress_hyper_6_31_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
(42 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space_compressed
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_5_19_chunk.device_id, _hyper_5_19_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk.device_id, compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_35_chunk.device_id, compress_hyper_6_35_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_34_chunk.device_id, compress_hyper_6_34_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_33_chunk.device_id, compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_32_chunk.device_id, compress_hyper_6_32_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_31_chunk.device_id, compress_hyper_6_31_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
(42 rows)
:PREFIX EXECUTE prep;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Limit (actual rows=100 loops=1)
-> Custom Scan (ConstraintAwareAppend) (actual rows=100 loops=1)
Hypertable: metrics_space_compressed
Chunks left after exclusion: 6
-> Merge Append (actual rows=100 loops=1)
Sort Key: _hyper_5_19_chunk.device_id, _hyper_5_19_chunk."time"
-> Custom Scan (DecompressChunk) on _hyper_5_19_chunk (actual rows=100 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_36_chunk.device_id, compress_hyper_6_36_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_36_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_20_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_35_chunk.device_id, compress_hyper_6_35_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_35_chunk (actual rows=12 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_21_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_34_chunk.device_id, compress_hyper_6_34_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_34_chunk (actual rows=4 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_22_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_33_chunk.device_id, compress_hyper_6_33_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_33_chunk (actual rows=6 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_23_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_32_chunk.device_id, compress_hyper_6_32_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_32_chunk (actual rows=18 loops=1)
-> Custom Scan (DecompressChunk) on _hyper_5_24_chunk (actual rows=1 loops=1)
Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone)
-> Sort (actual rows=1 loops=1)
Sort Key: compress_hyper_6_31_chunk.device_id, compress_hyper_6_31_chunk._ts_meta_sequence_num DESC
Sort Method: quicksort
-> Seq Scan on compress_hyper_6_31_chunk (actual rows=6 loops=1)
(42 rows)
DEALLOCATE prep;
RESET timescaledb.enable_chunk_append;
-- get results for all the queries
-- run queries on uncompressed hypertable and store result
\set PREFIX ''
\set PREFIX_VERBOSE ''
\set ECHO none