From 8d297607230f831f58e00578b2e6d2ddfa3e111a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Nordstr=C3=B6m?= Date: Mon, 2 Dec 2024 18:37:36 +0100 Subject: [PATCH 1/7] Add workaround for pg_depend bug in PG < 15.4 PostgreSQL versions prior to 15.4 didn't properly update object dependencies when setting a new access method on a table. The fix for the bug is found in this commit: https://github.com/postgres/postgres/commit/97d89101045fac8cb36f4ef6c08526ea0841a596 The `hypercore_create` test failed on buggy PG versions (e.g., 15.0) due to wrong contents of pg_depend showing up in test output when converting a table from Hypercore TAM back to regular heap. This change adds a workaround that updates pg_depend with the correct information when compiling against PG versions that suffer from the bug. --- tsl/src/compression/api.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tsl/src/compression/api.c b/tsl/src/compression/api.c index 7e25c20952a..f57460a4875 100644 --- a/tsl/src/compression/api.c +++ b/tsl/src/compression/api.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -777,13 +778,26 @@ set_access_method(Oid relid, const char *amname) }; bool to_hypercore = strcmp(amname, TS_HYPERCORE_TAM_NAME) == 0; Oid amoid = ts_get_rel_am(relid); + Oid new_amoid = get_am_oid(amname, false); /* Setting the same access method is a no-op */ - if (amoid == get_am_oid(amname, false)) + if (amoid == new_amoid) return relid; hypercore_alter_access_method_begin(relid, !to_hypercore); AlterTableInternal(relid, list_make1(&cmd), false); + +#if (PG_VERSION_NUM < 150004) + /* Fix for PostgreSQL bug where pg_depend was not updated to reflect the + * new dependency between AM and relation. See related PG fix here: + * https://github.com/postgres/postgres/commit/97d89101045fac8cb36f4ef6c08526ea0841a596 */ + if (changeDependencyFor(RelationRelationId, relid, AccessMethodRelationId, amoid, new_amoid) != + 1) + elog(ERROR, + "could not change access method dependency for relation \"%s.%s\"", + get_namespace_name(get_rel_namespace(relid)), + get_rel_name(relid)); +#endif hypercore_alter_access_method_finish(relid, !to_hypercore); #else From 049714cdedb0ec1b377437927f675aad516361a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADzio=20de=20Royes=20Mello?= Date: Mon, 2 Dec 2024 21:08:46 -0300 Subject: [PATCH 2/7] Encapsulate runner output cleanup into single script --- test/runner.sh | 12 +----------- test/runner_cleanup_output.sh | 30 ++++++++++++++++++++++++++++++ test/runner_isolation.sh | 6 ++---- test/runner_shared.sh | 16 +--------------- 4 files changed, 34 insertions(+), 30 deletions(-) create mode 100755 test/runner_cleanup_output.sh diff --git a/test/runner.sh b/test/runner.sh index a37f566d870..82c852b6ef2 100755 --- a/test/runner.sh +++ b/test/runner.sh @@ -148,14 +148,4 @@ ${PSQL} -U ${TEST_PGUSER} \ -v TSL_MODULE_PATHNAME="'timescaledb-tsl-${EXT_VERSION}'" \ -v TEST_SUPPORT_FILE=${TEST_SUPPORT_FILE} \ -v TEST_SUPPORT_FILE_INIT=${TEST_SUPPORT_FILE_INIT} \ - "$@" -d ${TEST_DBNAME} 2>&1 | \ - sed -e '//,/<\/exclude_from_test>/d' \ - -e 's! Memory: [0-9]\{1,\}kB!!' \ - -e 's! Memory Usage: [0-9]\{1,\}kB!!' \ - -e 's! Average Peak Memory: [0-9]\{1,\}kB!!' | \ - grep -v 'DEBUG: rehashing catalog cache id' | \ - grep -v 'DEBUG: compacted fsync request queue from' | \ - grep -v 'DEBUG: creating and filling new WAL file' | \ - grep -v 'DEBUG: done creating and filling new WAL file' | \ - grep -v 'DEBUG: flushed relation because a checkpoint occurred concurrently' | \ - grep -v 'NOTICE: cancelling the background worker for job' + "$@" -d ${TEST_DBNAME} 2>&1 | ${CURRENT_DIR}/runner_cleanup_output.sh diff --git a/test/runner_cleanup_output.sh b/test/runner_cleanup_output.sh new file mode 100755 index 00000000000..2a670f772e0 --- /dev/null +++ b/test/runner_cleanup_output.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -u +set -e + +RUNNER=${1:-""} + +sed -e '//,/<\/exclude_from_test>/d' \ + -e 's! Memory: [0-9]\{1,\}kB!!' \ + -e 's! Memory Usage: [0-9]\{1,\}kB!!' \ + -e 's! Average Peak Memory: [0-9]\{1,\}kB!!' | \ +grep -v 'DEBUG: rehashing catalog cache id' | \ +grep -v 'DEBUG: compacted fsync request queue from' | \ +grep -v 'DEBUG: creating and filling new WAL file' | \ +grep -v 'DEBUG: done creating and filling new WAL file' | \ +grep -v 'DEBUG: flushed relation because a checkpoint occurred concurrently' | \ +grep -v 'NOTICE: cancelling the background worker for job' | \ +if [ "${RUNNER}" = "shared" ]; then \ + sed -e '/^-\{1,\}$/d' \ + -e 's!_[0-9]\{1,\}_[0-9]\{1,\}_chunk!_X_X_chunk!g' \ + -e 's!^ \{1,\}QUERY PLAN \{1,\}$!QUERY PLAN!'; \ +else \ + cat; \ +fi | \ +if [ "${RUNNER}" = "isolation" ]; then \ + sed -e 's!_[0-9]\{1,\}_[0-9]\{1,\}_chunk!_X_X_chunk!g' \ + -e 's!hypertable_[0-9]\{1,\}!hypertable_X!g'; \ +else \ + cat; \ +fi diff --git a/test/runner_isolation.sh b/test/runner_isolation.sh index e9649c5f0ef..5f832b7bec4 100755 --- a/test/runner_isolation.sh +++ b/test/runner_isolation.sh @@ -7,6 +7,7 @@ set -e set -u +CURRENT_DIR=$(dirname $0) ISOLATIONTEST=$1 shift @@ -18,7 +19,4 @@ shift # the chunk numbers influence the names of indexes if they are long enough to be # truncated, so the only way to get a stable explain output is to run such a test # in a separate database. -$ISOLATIONTEST "$@" | \ - sed -e 's!_[0-9]\{1,\}_[0-9]\{1,\}_chunk!_X_X_chunk!g' \ - -e 's!hypertable_[0-9]\{1,\}!hypertable_X!g' - +$ISOLATIONTEST "$@" | ${CURRENT_DIR}/runner_cleanup_output.sh "isolation" diff --git a/test/runner_shared.sh b/test/runner_shared.sh index 2a4dd81e9c7..43e06ee96dd 100755 --- a/test/runner_shared.sh +++ b/test/runner_shared.sh @@ -79,18 +79,4 @@ ${PSQL} -U ${TEST_PGUSER} \ -v ROLE_DEFAULT_PERM_USER_2=${TEST_ROLE_DEFAULT_PERM_USER_2} \ -v MODULE_PATHNAME="'timescaledb-${EXT_VERSION}'" \ -v TSL_MODULE_PATHNAME="'timescaledb-tsl-${EXT_VERSION}'" \ - "$@" -d ${TEST_DBNAME} 2>&1 | \ - sed -e '//,/<\/exclude_from_test>/d' \ - -e 's!_[0-9]\{1,\}_[0-9]\{1,\}_chunk!_X_X_chunk!g' \ - -e 's!^ \{1,\}QUERY PLAN \{1,\}$!QUERY PLAN!' \ - -e 's!: actual rows!: actual rows!' \ - -e '/^-\{1,\}$/d' \ - -e 's! Memory: [0-9]\{1,\}kB!!' \ - -e 's! Memory Usage: [0-9]\{1,\}kB!!' \ - -e 's! Average Peak Memory: [0-9]\{1,\}kB!!' | \ - grep -v 'DEBUG: rehashing catalog cache id' | \ - grep -v 'DEBUG: compacted fsync request queue from' | \ - grep -v 'DEBUG: creating and filling new WAL file' | \ - grep -v 'DEBUG: done creating and filling new WAL file' | \ - grep -v 'DEBUG: flushed relation because a checkpoint occurred concurrently' | \ - grep -v 'NOTICE: cancelling the background worker for job' + "$@" -d ${TEST_DBNAME} 2>&1 | ${CURRENT_DIR}/runner_cleanup_output.sh "shared" From 1017ade407d5eba6304fcb54a7e7082c9331ee23 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Thu, 28 Nov 2024 10:14:14 +0100 Subject: [PATCH 3/7] Add tests for exclude constraints on Hypercore TAM Add tests that exclude constraints work on Hypercore TAM tables. This is right now limited to BTree indexes for the hypertable, but we add a GiST exclusion constraint on a chunk and test that it works. --- tsl/test/expected/hypercore_constraints.out | 189 ++++++++++++++++++++ tsl/test/sql/CMakeLists.txt | 5 +- tsl/test/sql/hypercore_constraints.sql | 80 +++++++++ 3 files changed, 272 insertions(+), 2 deletions(-) create mode 100644 tsl/test/expected/hypercore_constraints.out create mode 100644 tsl/test/sql/hypercore_constraints.sql diff --git a/tsl/test/expected/hypercore_constraints.out b/tsl/test/expected/hypercore_constraints.out new file mode 100644 index 00000000000..f430699a12f --- /dev/null +++ b/tsl/test/expected/hypercore_constraints.out @@ -0,0 +1,189 @@ +-- 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. +\c :TEST_DBNAME :ROLE_SUPERUSER; +\ir include/setup_hypercore.sql +-- 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. +\set hypertable readings +\ir hypercore_helpers.sql +-- 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. +-- Function to run an explain analyze with and do replacements on the +-- emitted plan. This is intended to be used when the structure of the +-- plan is important, but not the specific chunks scanned nor the +-- number of heap fetches, rows, loops, etc. +create function explain_analyze_anonymize(text) returns setof text +language plpgsql as +$$ +declare + ln text; +begin + for ln in + execute format('explain (analyze, costs off, summary off, timing off, decompress_cache_stats) %s', $1) + loop + if trim(both from ln) like 'Group Key:%' then + continue; + end if; + ln := regexp_replace(ln, 'Array Cache Hits: \d+', 'Array Cache Hits: N'); + ln := regexp_replace(ln, 'Array Cache Misses: \d+', 'Array Cache Misses: N'); + ln := regexp_replace(ln, 'Array Cache Evictions: \d+', 'Array Cache Evictions: N'); + ln := regexp_replace(ln, 'Heap Fetches: \d+', 'Heap Fetches: N'); + ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N'); + ln := regexp_replace(ln, 'actual rows=\d+ loops=\d+', 'actual rows=N loops=N'); + ln := regexp_replace(ln, '_hyper_\d+_\d+_chunk', '_hyper_I_N_chunk', 1, 0); + return next ln; + end loop; +end; +$$; +create function explain_anonymize(text) returns setof text +language plpgsql as +$$ +declare + ln text; +begin + for ln in + execute format('explain (costs off, summary off, timing off) %s', $1) + loop + ln := regexp_replace(ln, 'Array Cache Hits: \d+', 'Array Cache Hits: N'); + ln := regexp_replace(ln, 'Array Cache Misses: \d+', 'Array Cache Misses: N'); + ln := regexp_replace(ln, 'Array Cache Evictions: \d+', 'Array Cache Evictions: N'); + ln := regexp_replace(ln, 'Heap Fetches: \d+', 'Heap Fetches: N'); + ln := regexp_replace(ln, 'Workers Launched: \d+', 'Workers Launched: N'); + ln := regexp_replace(ln, 'actual rows=\d+ loops=\d+', 'actual rows=N loops=N'); + ln := regexp_replace(ln, '_hyper_\d+_\d+_chunk', '_hyper_I_N_chunk', 1, 0); + return next ln; + end loop; +end; +$$; +create table :hypertable( + metric_id serial, + created_at timestamptz not null unique, + location_id smallint, --segmentby attribute with index + owner_id bigint, --segmentby attribute without index + device_id bigint, --non-segmentby attribute + temp float8, + humidity float4 +); +create index hypertable_location_id_idx on :hypertable (location_id); +create index hypertable_device_id_idx on :hypertable (device_id); +select create_hypertable(:'hypertable', by_range('created_at')); + create_hypertable +------------------- + (1,t) +(1 row) + +-- Disable incremental sort to make tests stable +set enable_incremental_sort = false; +select setseed(1); + setseed +--------- + +(1 row) + +-- Insert rows into the tables. +-- +-- The timestamps for the original rows will have timestamps every 10 +-- seconds. Any other timestamps are inserted as part of the test. +insert into :hypertable (created_at, location_id, device_id, owner_id, temp, humidity) +select t, ceil(random()*10), ceil(random()*30), ceil(random() * 5), random()*40, random()*100 +from generate_series('2022-06-01'::timestamptz, '2022-07-01', '5m') t; +alter table :hypertable set ( + timescaledb.compress, + timescaledb.compress_orderby = 'created_at', + timescaledb.compress_segmentby = 'location_id, owner_id' +); +-- Get some test chunks as global variables (first and last chunk here) +select format('%I.%I', chunk_schema, chunk_name)::regclass as chunk1 + from timescaledb_information.chunks + where format('%I.%I', hypertable_schema, hypertable_name)::regclass = :'hypertable'::regclass + order by chunk1 asc + limit 1 \gset +select format('%I.%I', chunk_schema, chunk_name)::regclass as chunk2 + from timescaledb_information.chunks + where format('%I.%I', hypertable_schema, hypertable_name)::regclass = :'hypertable'::regclass + order by chunk2 asc + limit 1 offset 1 \gset +-- Drop the unique constraint and replace it with an exclusion +-- constraint doing the same thing. +alter table :hypertable drop constraint readings_created_at_key; +alter table :hypertable add exclude (created_at with =); +create table sample (like :chunk1 including generated including defaults including constraints); +insert into sample(created_at, location_id, device_id, owner_id, temp, humidity) + values + ('2022-06-01 00:01:23', 999, 666, 111, 3.14, 3.14), + ('2022-06-01 00:02:23', 999, 666, 112, 3.14, 3.14), + ('2022-06-01 00:03:23', 999, 666, 113, 3.14, 3.14), + ('2022-06-01 00:04:23', 999, 666, 114, 3.14, 3.14); +insert into :chunk1(created_at, location_id, device_id, owner_id, temp, humidity) +select created_at, location_id, device_id, owner_id, temp, humidity from sample; +select compress_chunk(show_chunks(:'hypertable'), hypercore_use_access_method => true); + compress_chunk +---------------------------------------- + _timescaledb_internal._hyper_1_1_chunk + _timescaledb_internal._hyper_1_2_chunk + _timescaledb_internal._hyper_1_3_chunk + _timescaledb_internal._hyper_1_4_chunk + _timescaledb_internal._hyper_1_5_chunk + _timescaledb_internal._hyper_1_6_chunk +(6 rows) + +-- These should fail the exclusion constraint +\set ON_ERROR_STOP 0 +insert into :hypertable(created_at, location_id, device_id, owner_id, temp, humidity) +select created_at, location_id, device_id, owner_id, temp, humidity from sample; +ERROR: conflicting key value violates exclusion constraint "1_7_readings_created_at_excl" +insert into :chunk1(created_at, location_id, device_id, owner_id, temp, humidity) +select created_at, location_id, device_id, owner_id, temp, humidity from sample; +ERROR: conflicting key value violates exclusion constraint "1_7_readings_created_at_excl" +\set ON_ERROR_STOP 0 +create table test_exclude( + created_at timestamptz not null unique, + device_id bigint, + humidity numrange +); +select create_hypertable('test_exclude', by_range('created_at')); + create_hypertable +------------------- + (3,t) +(1 row) + +create or replace function randrange() returns numrange as $$ +declare + start numeric := 100.0 * random()::numeric; +begin + return numrange(start, start + random()::numeric); +end; +$$ language plpgsql; +-- Insert a bunch or rows with a random humidity range. +insert into test_exclude (created_at, device_id, humidity) +select ts, ceil(random()*30), randrange() +from generate_series('2022-06-01'::timestamptz, '2022-07-01', '5m') ts; +-- Pick a chunk to work with. +select exclude_chunk from show_chunks('test_exclude') tbl(exclude_chunk) limit 1 \gset +-- Find all rows that is a duplicate of a previous row. +select * into dups from :exclude_chunk o where ( + select count(*) + from :exclude_chunk i + where i.created_at < o.created_at and i.humidity && o.humidity +) > 0; +-- Make sure we have some duplicates. Otherwise, the test does not work. +select count(*) > 0 from dups; + ?column? +---------- + t +(1 row) + +-- Delete the duplicates. +delete from :exclude_chunk where created_at in (select created_at from dups); +-- Add an exclusion constraint. +alter table :exclude_chunk add constraint humidity_overlap exclude using gist (humidity with &&); +-- Make sure that inserting some duplicate fails on this the exclusion constraint. +\set ON_ERROR_STOP 0 +insert into :exclude_chunk select * from dups limit 10; +ERROR: conflicting key value violates exclusion constraint "humidity_overlap" +insert into test_exclude select * from dups limit 10; +ERROR: conflicting key value violates exclusion constraint "humidity_overlap" +\set ON_ERROR_STOP 1 diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index 35ab0747ed0..041f9300c10 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -144,6 +144,7 @@ if((${PG_VERSION_MAJOR} GREATER_EQUAL "15")) TEST_FILES cagg_refresh_using_merge.sql hypercore_columnar.sql + hypercore_constraints.sql hypercore_copy.sql hypercore_create.sql hypercore_cursor.sql @@ -162,8 +163,8 @@ if((${PG_VERSION_MAJOR} GREATER_EQUAL "15")) hypercore_types.sql hypercore_update.sql hypercore_vacuum.sql - merge_compress.sql - hypercore_vacuum_full.sql) + hypercore_vacuum_full.sql + merge_compress.sql) endif() if((${PG_VERSION_MAJOR} GREATER_EQUAL "16")) diff --git a/tsl/test/sql/hypercore_constraints.sql b/tsl/test/sql/hypercore_constraints.sql new file mode 100644 index 00000000000..d13976764cc --- /dev/null +++ b/tsl/test/sql/hypercore_constraints.sql @@ -0,0 +1,80 @@ +-- 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. + +\c :TEST_DBNAME :ROLE_SUPERUSER; + +\ir include/setup_hypercore.sql + +-- Drop the unique constraint and replace it with an exclusion +-- constraint doing the same thing. +alter table :hypertable drop constraint readings_created_at_key; +alter table :hypertable add exclude (created_at with =); + +create table sample (like :chunk1 including generated including defaults including constraints); +insert into sample(created_at, location_id, device_id, owner_id, temp, humidity) + values + ('2022-06-01 00:01:23', 999, 666, 111, 3.14, 3.14), + ('2022-06-01 00:02:23', 999, 666, 112, 3.14, 3.14), + ('2022-06-01 00:03:23', 999, 666, 113, 3.14, 3.14), + ('2022-06-01 00:04:23', 999, 666, 114, 3.14, 3.14); + +insert into :chunk1(created_at, location_id, device_id, owner_id, temp, humidity) +select created_at, location_id, device_id, owner_id, temp, humidity from sample; + +select compress_chunk(show_chunks(:'hypertable'), hypercore_use_access_method => true); + +-- These should fail the exclusion constraint +\set ON_ERROR_STOP 0 +insert into :hypertable(created_at, location_id, device_id, owner_id, temp, humidity) +select created_at, location_id, device_id, owner_id, temp, humidity from sample; + +insert into :chunk1(created_at, location_id, device_id, owner_id, temp, humidity) +select created_at, location_id, device_id, owner_id, temp, humidity from sample; +\set ON_ERROR_STOP 0 + +create table test_exclude( + created_at timestamptz not null unique, + device_id bigint, + humidity numrange +); + +select create_hypertable('test_exclude', by_range('created_at')); + +create or replace function randrange() returns numrange as $$ +declare + start numeric := 100.0 * random()::numeric; +begin + return numrange(start, start + random()::numeric); +end; +$$ language plpgsql; + +-- Insert a bunch or rows with a random humidity range. +insert into test_exclude (created_at, device_id, humidity) +select ts, ceil(random()*30), randrange() +from generate_series('2022-06-01'::timestamptz, '2022-07-01', '5m') ts; + +-- Pick a chunk to work with. +select exclude_chunk from show_chunks('test_exclude') tbl(exclude_chunk) limit 1 \gset + +-- Find all rows that is a duplicate of a previous row. +select * into dups from :exclude_chunk o where ( + select count(*) + from :exclude_chunk i + where i.created_at < o.created_at and i.humidity && o.humidity +) > 0; + +-- Make sure we have some duplicates. Otherwise, the test does not work. +select count(*) > 0 from dups; + +-- Delete the duplicates. +delete from :exclude_chunk where created_at in (select created_at from dups); + +-- Add an exclusion constraint. +alter table :exclude_chunk add constraint humidity_overlap exclude using gist (humidity with &&); + +-- Make sure that inserting some duplicate fails on this the exclusion constraint. +\set ON_ERROR_STOP 0 +insert into :exclude_chunk select * from dups limit 10; +insert into test_exclude select * from dups limit 10; +\set ON_ERROR_STOP 1 From f1d201e5eed5ab3d1f65c19b4cf3cc9a6ea9969e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADzio=20de=20Royes=20Mello?= Date: Mon, 2 Dec 2024 21:17:37 -0300 Subject: [PATCH 4/7] Fix flaky append regression test Fixed it by manually running `VACUUM ANALYZE` in all involved hypertables to avoid flaky output tests. --- test/expected/append-14.out | 647 ++++++++++++++--------------- test/expected/append-15.out | 649 +++++++++++++++--------------- test/expected/append-16.out | 649 +++++++++++++++--------------- test/expected/append-17.out | 649 +++++++++++++++--------------- test/sql/include/append_load.sql | 14 +- test/sql/include/append_query.sql | 3 +- 6 files changed, 1345 insertions(+), 1266 deletions(-) diff --git a/test/expected/append-14.out b/test/expected/append-14.out index 8eca55177b4..b7c4e743f06 100644 --- a/test/expected/append-14.out +++ b/test/expected/append-14.out @@ -57,10 +57,11 @@ INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2 ('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'), ('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'), ('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}'); +VACUUM (ANALYZE) append_test; -- Create another hypertable to join with CREATE TABLE join_test(time timestamptz, temp float, colorid integer); SELECT create_hypertable('join_test', 'time', chunk_time_interval => 2628000000000); -psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column "time" +psql:include/append_load.sql:47: NOTICE: adding not-null constraint to column "time" create_hypertable ------------------------ (2,public,join_test,t) @@ -69,11 +70,13 @@ psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column " INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1), ('2017-02-22T09:18:22', 24.5, 2), ('2017-08-22T09:18:22', 23.1, 3); +VACUUM (ANALYZE) join_test; -- Create another table to join with which is not a hypertable. CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb); INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'), ('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'), ('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}'); +VACUUM (ANALYZE) join_test_plain; -- create hypertable with DATE time dimension CREATE TABLE metrics_date(time DATE NOT NULL); SELECT create_hypertable('metrics_date','time'); @@ -83,18 +86,18 @@ SELECT create_hypertable('metrics_date','time'); (1 row) INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_date; +VACUUM (ANALYZE) metrics_date; -- create hypertable with TIMESTAMP time dimension CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL); SELECT create_hypertable('metrics_timestamp','time'); -psql:include/append_load.sql:67: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices +psql:include/append_load.sql:70: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices create_hypertable -------------------------------- (4,public,metrics_timestamp,t) (1 row) INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_timestamp; +VACUUM (ANALYZE) metrics_timestamp; -- create hypertable with TIMESTAMPTZ time dimension CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL); CREATE INDEX ON metrics_timestamptz(device_id,time); @@ -107,7 +110,7 @@ SELECT create_hypertable('metrics_timestamptz','time'); INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3; -ANALYZE metrics_timestamptz; +VACUUM (ANALYZE) metrics_timestamptz; -- create space partitioned hypertable CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text); SELECT create_hypertable('metrics_space','time','device_id',3); @@ -121,7 +124,7 @@ SELECT time, device_id, device_id + 0.25, device_id + 0.75, device_id FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m'::interval) g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; -ANALYZE metrics_space; +VACUUM (ANALYZE) metrics_space; -- test ChunkAppend projection #2661 CREATE TABLE i2661 ( machine_id int4 NOT NULL, @@ -130,14 +133,14 @@ CREATE TABLE i2661 ( "first" float4 NULL ); SELECT create_hypertable('i2661', 'timestamp'); -psql:include/append_load.sql:99: WARNING: column type "character varying" used for "name" does not follow best practices +psql:include/append_load.sql:102: WARNING: column type "character varying" used for "name" does not follow best practices create_hypertable -------------------- (7,public,i2661,t) (1 row) INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0; -ANALYZE i2661; +VACUUM (ANALYZE) i2661; \ir :TEST_QUERY_NAME -- This file and its contents are licensed under the Apache License 2.0. -- Please see the included NOTICE for copyright information and @@ -162,12 +165,14 @@ psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! - QUERY PLAN ------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) - Order: append_test."time" DESC - Chunks excluded during startup: 3 -(3 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=0 loops=1) + Sort Key: append_test."time" DESC + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) + Chunks excluded during startup: 3 +(5 rows) --query should exclude all chunks and be a MergeAppend :PREFIX @@ -202,12 +207,12 @@ psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------ Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) (4 rows) -- adding ORDER BY and LIMIT should turn the plan into an optimized @@ -223,15 +228,17 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Limit (actual rows=1 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(6 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(8 rows) -- no optimized plan for queries with restrictions that can be -- constified at planning time. Regular planning-time constraint @@ -240,14 +247,16 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! SELECT * FROM append_test WHERE time > now_i() - interval '2 months' ORDER BY time; psql:include/append_query.sql:37: NOTICE: Immutable function now_i() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) +(7 rows) -- currently, we cannot distinguish between stable and volatile -- functions as far as applying our modified plan. However, volatile @@ -261,20 +270,22 @@ psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) -(11 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 0 + -> Seq Scan on _hyper_1_1_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) +(13 rows) -- prepared statement output should be the same regardless of -- optimizations @@ -290,14 +301,16 @@ psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(7 rows) DEALLOCATE query_opt; -- aggregates should produce same output @@ -315,18 +328,21 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! + QUERY PLAN +------------------------------------------------------------------------------ GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(9 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (date_trunc('year'::text, append_test."time")) DESC + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Chunks excluded during startup: 1 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) +(11 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -357,11 +373,14 @@ SELECT * FROM append_test WHERE time > $1 ORDER BY time; :PREFIX EXECUTE query_param(now_s() - interval '2 months'); psql:include/append_query.sql:82: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) -(2 rows) + QUERY PLAN +------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) +(5 rows) DEALLOCATE query_param; --test with cte @@ -392,8 +411,10 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! + QUERY PLAN +----------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -408,16 +429,13 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! Batches: 1 -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(23 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) +(20 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE @@ -444,6 +462,8 @@ psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! btime | value ------------------------------+------- @@ -480,18 +500,18 @@ psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=1 loops=1) Join Filter: (a.colorid = j.colorid) -> Custom Scan (ChunkAppend) on append_test a (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) -> Custom Scan (ChunkAppend) on join_test j (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_2_6_chunk_join_test_time_idx on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) (10 rows) reset enable_hashjoin; @@ -506,13 +526,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -522,13 +542,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -539,13 +559,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -557,13 +577,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -573,13 +593,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -590,13 +610,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -608,10 +628,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -621,10 +641,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -635,10 +655,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamp time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -650,13 +670,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -666,13 +686,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -683,13 +703,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -701,13 +721,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -717,13 +737,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -734,13 +754,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -752,10 +772,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -765,10 +785,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -779,10 +799,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamptz time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -795,13 +815,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -812,13 +832,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -828,13 +848,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test Const OP Var @@ -847,13 +867,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -864,13 +884,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -880,13 +900,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test 2 constraints @@ -899,10 +919,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -913,10 +933,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -926,10 +946,10 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (8 rows) -- test constraint_exclusion with space partitioning and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -954,24 +974,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp ORDER BY time; @@ -994,24 +1014,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz ORDER BY time; @@ -1023,24 +1043,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test Const OP Var @@ -1065,24 +1085,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamp < time ORDER BY time; @@ -1105,24 +1125,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamptz < time ORDER BY time; @@ -1134,24 +1154,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test 2 constraints @@ -1176,24 +1196,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp AND time < '2000-01-15'::timestamp ORDER BY time; @@ -1216,24 +1236,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND time < '2000-01-15'::timestamptz ORDER BY time; @@ -1245,24 +1265,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test filtering on space partition @@ -1273,38 +1293,32 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (1,2) ORDER BY time; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=2304 loops=1) - Order: metrics_space."time" - -> Merge Append (actual rows=1534 loops=1) - Sort Key: _hyper_6_25_chunk."time" - -> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Merge Append (actual rows=770 loops=1) - Sort Key: _hyper_6_28_chunk."time" - -> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 - -> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 -(22 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=2304 loops=1) + Sort Key: _hyper_6_25_chunk."time" + Sort Method: quicksort + -> Append (actual rows=2304 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 +(16 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (VALUES(1)) ORDER BY time; QUERY PLAN @@ -1313,10 +1327,10 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND v3 IN (VALUES('1')) ORDER BY time; @@ -1683,33 +1697,33 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=1 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=26787) Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: ("time" = m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m2_3 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m2_4 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=4611) Index Cond: ("time" = m1."time") - Heap Fetches: 4611 + Heap Fetches: 0 (31 rows) -- test runtime exclusion and startup exclusions @@ -1720,25 +1734,25 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=0 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=0 loops=26787) Chunks excluded during startup: 3 Chunks excluded during runtime: 1 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 3744 + Heap Fetches: 0 (23 rows) -- test runtime exclusion does not activate for constraints on non-partitioning columns @@ -1778,19 +1792,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 5 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 6 + Heap Fetches: 0 (20 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time=g.time) m ON true; @@ -1818,19 +1832,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=3 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 15 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=3 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 18 + Heap Fetches: 0 (19 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time>g.time + '1 day' ORDER BY time LIMIT 1) m ON true; @@ -1845,19 +1859,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 2 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=4) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 4 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 5 + Heap Fetches: 0 (22 rows) -- test runtime exclusion with subquery @@ -1874,7 +1888,7 @@ ORDER BY time DESC, device_id; Order: metrics_timestamptz."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=1 loops=1) Index Cond: ("time" IS NOT NULL) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (never executed) Index Cond: ("time" IS NOT NULL) Heap Fetches: 0 @@ -1901,7 +1915,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=3 loops=1) Index Cond: ("time" = $1) - Heap Fetches: 3 + Heap Fetches: 0 (38 rows) -- test runtime exclusion with correlated subquery @@ -1912,10 +1926,10 @@ ORDER BY time DESC, device_id; Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=3744 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 SubPlan 1 -> Limit (actual rows=1 loops=7776) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=7776) @@ -1932,10 +1946,10 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_4 (actual rows=1 loops=3741) Index Cond: ("time" < m1."time") - Heap Fetches: 3741 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_5 (actual rows=1 loops=4035) Index Cond: ("time" < m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 (28 rows) -- test EXISTS @@ -1947,7 +1961,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=1003 loops=1) Order: m1."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_1 (actual rows=1003 loops=1) - Heap Fetches: 1003 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_2 (never executed) Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (never executed) @@ -1971,7 +1985,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=1003) Index Cond: ("time" > m1."time") - Heap Fetches: 1000 + Heap Fetches: 0 (30 rows) -- test constraint exclusion for subqueries with append @@ -1984,10 +1998,10 @@ ORDER BY time DESC, device_id; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (9 rows) -- test constraint exclusion for subqueries with mergeappend @@ -2002,10 +2016,10 @@ ORDER BY time DESC, device_id; Sort Key: _hyper_5_17_chunk.device_id, _hyper_5_17_chunk."time" -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (11 rows) -- test LIMIT pushdown @@ -2017,7 +2031,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=1 loops=1) Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (never executed) Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (never executed) @@ -2043,21 +2057,23 @@ ORDER BY time DESC, device_id; (8 rows) :PREFIX SELECT count(*) FROM metrics_space LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) -> Append (actual rows=37450 loops=1) -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(12 rows) +(14 rows) -- HAVING should prevent pushdown :PREFIX SELECT 1 FROM metrics_timestamptz HAVING count(*) > 1 LIMIT 1; @@ -2075,8 +2091,8 @@ ORDER BY time DESC, device_id; (9 rows) :PREFIX SELECT 1 FROM metrics_space HAVING count(*) > 1 LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) Filter: (count(*) > 1) @@ -2084,13 +2100,15 @@ ORDER BY time DESC, device_id; -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(13 rows) +(15 rows) -- DISTINCT should prevent pushdown SET enable_hashagg TO false; @@ -2102,15 +2120,15 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=17859 loops=1) Sort Key: _hyper_5_17_chunk.device_id -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=2689 loops=1) - Heap Fetches: 2689 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_19_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_20_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_21_chunk (actual rows=3075 loops=1) - Heap Fetches: 3075 + Heap Fetches: 0 (14 rows) :PREFIX SELECT DISTINCT device_id FROM metrics_space ORDER BY device_id LIMIT 3; @@ -2121,23 +2139,23 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=7491 loops=1) Sort Key: _hyper_6_22_chunk.device_id -> Index Only Scan using _hyper_6_22_chunk_metrics_space_device_id_time_idx on _hyper_6_22_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_23_chunk_metrics_space_device_id_time_idx on _hyper_6_23_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_24_chunk_metrics_space_device_id_time_idx on _hyper_6_24_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_27_chunk_metrics_space_device_id_time_idx on _hyper_6_27_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_30_chunk_metrics_space_device_id_time_idx on _hyper_6_30_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (22 rows) RESET enable_hashagg; @@ -2159,6 +2177,7 @@ SELECT time, device_id FROM generate_series('2000-01-01'::timestamptz,'2000-01-21','30m') g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; +VACUUM (ANALYZE) join_limit; -- get 2nd chunk oid SELECT tableoid AS "CHUNK_OID" FROM join_limit WHERE time > '2000-01-07' ORDER BY time LIMIT 1 \gset @@ -2249,7 +2268,7 @@ SELECT table_name FROM create_hypertable('i3030', 'time', create_default_indexes CREATE INDEX ON i3030(a,time); INSERT INTO i3030 (time,a) SELECT time, a FROM generate_series('2000-01-01'::timestamptz,'2000-01-01 3:00:00'::timestamptz,'1min'::interval) time, generate_series(1,30) a; -ANALYZE i3030; +VACUUM (ANALYZE) i3030; :PREFIX SELECT * FROM i3030 where time BETWEEN '2000-01-01'::text::timestamptz AND '2000-01-03'::text::timestamptz ORDER BY a,time LIMIT 1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/test/expected/append-15.out b/test/expected/append-15.out index a1244a5e31a..8b30431e8fc 100644 --- a/test/expected/append-15.out +++ b/test/expected/append-15.out @@ -57,10 +57,11 @@ INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2 ('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'), ('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'), ('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}'); +VACUUM (ANALYZE) append_test; -- Create another hypertable to join with CREATE TABLE join_test(time timestamptz, temp float, colorid integer); SELECT create_hypertable('join_test', 'time', chunk_time_interval => 2628000000000); -psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column "time" +psql:include/append_load.sql:47: NOTICE: adding not-null constraint to column "time" create_hypertable ------------------------ (2,public,join_test,t) @@ -69,11 +70,13 @@ psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column " INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1), ('2017-02-22T09:18:22', 24.5, 2), ('2017-08-22T09:18:22', 23.1, 3); +VACUUM (ANALYZE) join_test; -- Create another table to join with which is not a hypertable. CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb); INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'), ('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'), ('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}'); +VACUUM (ANALYZE) join_test_plain; -- create hypertable with DATE time dimension CREATE TABLE metrics_date(time DATE NOT NULL); SELECT create_hypertable('metrics_date','time'); @@ -83,18 +86,18 @@ SELECT create_hypertable('metrics_date','time'); (1 row) INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_date; +VACUUM (ANALYZE) metrics_date; -- create hypertable with TIMESTAMP time dimension CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL); SELECT create_hypertable('metrics_timestamp','time'); -psql:include/append_load.sql:67: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices +psql:include/append_load.sql:70: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices create_hypertable -------------------------------- (4,public,metrics_timestamp,t) (1 row) INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_timestamp; +VACUUM (ANALYZE) metrics_timestamp; -- create hypertable with TIMESTAMPTZ time dimension CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL); CREATE INDEX ON metrics_timestamptz(device_id,time); @@ -107,7 +110,7 @@ SELECT create_hypertable('metrics_timestamptz','time'); INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3; -ANALYZE metrics_timestamptz; +VACUUM (ANALYZE) metrics_timestamptz; -- create space partitioned hypertable CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text); SELECT create_hypertable('metrics_space','time','device_id',3); @@ -121,7 +124,7 @@ SELECT time, device_id, device_id + 0.25, device_id + 0.75, device_id FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m'::interval) g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; -ANALYZE metrics_space; +VACUUM (ANALYZE) metrics_space; -- test ChunkAppend projection #2661 CREATE TABLE i2661 ( machine_id int4 NOT NULL, @@ -130,14 +133,14 @@ CREATE TABLE i2661 ( "first" float4 NULL ); SELECT create_hypertable('i2661', 'timestamp'); -psql:include/append_load.sql:99: WARNING: column type "character varying" used for "name" does not follow best practices +psql:include/append_load.sql:102: WARNING: column type "character varying" used for "name" does not follow best practices create_hypertable -------------------- (7,public,i2661,t) (1 row) INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0; -ANALYZE i2661; +VACUUM (ANALYZE) i2661; \ir :TEST_QUERY_NAME -- This file and its contents are licensed under the Apache License 2.0. -- Please see the included NOTICE for copyright information and @@ -162,12 +165,14 @@ psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! - QUERY PLAN ------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) - Order: append_test."time" DESC - Chunks excluded during startup: 3 -(3 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=0 loops=1) + Sort Key: append_test."time" DESC + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) + Chunks excluded during startup: 3 +(5 rows) --query should exclude all chunks and be a MergeAppend :PREFIX @@ -202,12 +207,12 @@ psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------ Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) (4 rows) -- adding ORDER BY and LIMIT should turn the plan into an optimized @@ -223,15 +228,17 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Limit (actual rows=1 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(6 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(8 rows) -- no optimized plan for queries with restrictions that can be -- constified at planning time. Regular planning-time constraint @@ -240,14 +247,16 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! SELECT * FROM append_test WHERE time > now_i() - interval '2 months' ORDER BY time; psql:include/append_query.sql:37: NOTICE: Immutable function now_i() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) +(7 rows) -- currently, we cannot distinguish between stable and volatile -- functions as far as applying our modified plan. However, volatile @@ -261,20 +270,22 @@ psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) -(11 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 0 + -> Seq Scan on _hyper_1_1_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) +(13 rows) -- prepared statement output should be the same regardless of -- optimizations @@ -290,14 +301,16 @@ psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(7 rows) DEALLOCATE query_opt; -- aggregates should produce same output @@ -315,19 +328,22 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! + QUERY PLAN +------------------------------------------------------------------------------------ GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Result (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(10 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (date_trunc('year'::text, append_test."time")) DESC + Sort Method: quicksort + -> Result (actual rows=3 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Chunks excluded during startup: 1 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) +(12 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -358,11 +374,14 @@ SELECT * FROM append_test WHERE time > $1 ORDER BY time; :PREFIX EXECUTE query_param(now_s() - interval '2 months'); psql:include/append_query.sql:82: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) -(2 rows) + QUERY PLAN +------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) +(5 rows) DEALLOCATE query_param; --test with cte @@ -393,8 +412,10 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -410,16 +431,13 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Result (actual rows=5 loops=1) -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(24 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) +(21 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE @@ -446,6 +464,8 @@ psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! btime | value ------------------------------+------- @@ -482,18 +502,18 @@ psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=1 loops=1) Join Filter: (a.colorid = j.colorid) -> Custom Scan (ChunkAppend) on append_test a (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) -> Custom Scan (ChunkAppend) on join_test j (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_2_6_chunk_join_test_time_idx on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) (10 rows) reset enable_hashjoin; @@ -508,13 +528,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -524,13 +544,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -541,13 +561,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -559,13 +579,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -575,13 +595,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -592,13 +612,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -610,10 +630,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -623,10 +643,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -637,10 +657,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamp time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -652,13 +672,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -668,13 +688,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -685,13 +705,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -703,13 +723,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -719,13 +739,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -736,13 +756,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -754,10 +774,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -767,10 +787,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -781,10 +801,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamptz time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -797,13 +817,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -814,13 +834,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -830,13 +850,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test Const OP Var @@ -849,13 +869,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -866,13 +886,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -882,13 +902,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test 2 constraints @@ -901,10 +921,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -915,10 +935,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -928,10 +948,10 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (8 rows) -- test constraint_exclusion with space partitioning and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -956,24 +976,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp ORDER BY time; @@ -996,24 +1016,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz ORDER BY time; @@ -1025,24 +1045,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test Const OP Var @@ -1067,24 +1087,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamp < time ORDER BY time; @@ -1107,24 +1127,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamptz < time ORDER BY time; @@ -1136,24 +1156,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test 2 constraints @@ -1178,24 +1198,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp AND time < '2000-01-15'::timestamp ORDER BY time; @@ -1218,24 +1238,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND time < '2000-01-15'::timestamptz ORDER BY time; @@ -1247,24 +1267,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test filtering on space partition @@ -1275,38 +1295,32 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (1,2) ORDER BY time; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=2304 loops=1) - Order: metrics_space."time" - -> Merge Append (actual rows=1534 loops=1) - Sort Key: _hyper_6_25_chunk."time" - -> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Merge Append (actual rows=770 loops=1) - Sort Key: _hyper_6_28_chunk."time" - -> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 - -> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 -(22 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=2304 loops=1) + Sort Key: _hyper_6_25_chunk."time" + Sort Method: quicksort + -> Append (actual rows=2304 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 +(16 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (VALUES(1)) ORDER BY time; QUERY PLAN @@ -1315,10 +1329,10 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND v3 IN (VALUES('1')) ORDER BY time; @@ -1685,33 +1699,33 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=1 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=26787) Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: ("time" = m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m2_3 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m2_4 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=4611) Index Cond: ("time" = m1."time") - Heap Fetches: 4611 + Heap Fetches: 0 (31 rows) -- test runtime exclusion and startup exclusions @@ -1722,25 +1736,25 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=0 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=0 loops=26787) Chunks excluded during startup: 3 Chunks excluded during runtime: 1 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 3744 + Heap Fetches: 0 (23 rows) -- test runtime exclusion does not activate for constraints on non-partitioning columns @@ -1781,19 +1795,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 5 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 6 + Heap Fetches: 0 (21 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time=g.time) m ON true; @@ -1821,19 +1835,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=3 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 15 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=3 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 18 + Heap Fetches: 0 (19 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time>g.time + '1 day' ORDER BY time LIMIT 1) m ON true; @@ -1848,19 +1862,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 2 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=4) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 4 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 5 + Heap Fetches: 0 (22 rows) -- test runtime exclusion with subquery @@ -1877,7 +1891,7 @@ ORDER BY time DESC, device_id; Order: metrics_timestamptz."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=1 loops=1) Index Cond: ("time" IS NOT NULL) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (never executed) Index Cond: ("time" IS NOT NULL) Heap Fetches: 0 @@ -1904,7 +1918,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=3 loops=1) Index Cond: ("time" = $1) - Heap Fetches: 3 + Heap Fetches: 0 (38 rows) -- test runtime exclusion with correlated subquery @@ -1916,10 +1930,10 @@ ORDER BY time DESC, device_id; Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=3744 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 SubPlan 1 -> Limit (actual rows=1 loops=7776) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=7776) @@ -1936,10 +1950,10 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_4 (actual rows=1 loops=3741) Index Cond: ("time" < m1."time") - Heap Fetches: 3741 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_5 (actual rows=1 loops=4035) Index Cond: ("time" < m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 (29 rows) -- test EXISTS @@ -1951,7 +1965,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=1003 loops=1) Order: m1."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_1 (actual rows=1003 loops=1) - Heap Fetches: 1003 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_2 (never executed) Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (never executed) @@ -1975,7 +1989,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=1003) Index Cond: ("time" > m1."time") - Heap Fetches: 1000 + Heap Fetches: 0 (30 rows) -- test constraint exclusion for subqueries with append @@ -1988,10 +2002,10 @@ ORDER BY time DESC, device_id; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (9 rows) -- test constraint exclusion for subqueries with mergeappend @@ -2006,10 +2020,10 @@ ORDER BY time DESC, device_id; Sort Key: _hyper_5_17_chunk.device_id, _hyper_5_17_chunk."time" -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (11 rows) -- test LIMIT pushdown @@ -2021,7 +2035,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=1 loops=1) Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (never executed) Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (never executed) @@ -2047,21 +2061,23 @@ ORDER BY time DESC, device_id; (8 rows) :PREFIX SELECT count(*) FROM metrics_space LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) -> Append (actual rows=37450 loops=1) -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(12 rows) +(14 rows) -- HAVING should prevent pushdown :PREFIX SELECT 1 FROM metrics_timestamptz HAVING count(*) > 1 LIMIT 1; @@ -2079,8 +2095,8 @@ ORDER BY time DESC, device_id; (9 rows) :PREFIX SELECT 1 FROM metrics_space HAVING count(*) > 1 LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) Filter: (count(*) > 1) @@ -2088,13 +2104,15 @@ ORDER BY time DESC, device_id; -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(13 rows) +(15 rows) -- DISTINCT should prevent pushdown SET enable_hashagg TO false; @@ -2106,15 +2124,15 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=17859 loops=1) Sort Key: _hyper_5_17_chunk.device_id -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=2689 loops=1) - Heap Fetches: 2689 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_19_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_20_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_21_chunk (actual rows=3075 loops=1) - Heap Fetches: 3075 + Heap Fetches: 0 (14 rows) :PREFIX SELECT DISTINCT device_id FROM metrics_space ORDER BY device_id LIMIT 3; @@ -2125,23 +2143,23 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=7491 loops=1) Sort Key: _hyper_6_22_chunk.device_id -> Index Only Scan using _hyper_6_22_chunk_metrics_space_device_id_time_idx on _hyper_6_22_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_23_chunk_metrics_space_device_id_time_idx on _hyper_6_23_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_24_chunk_metrics_space_device_id_time_idx on _hyper_6_24_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_27_chunk_metrics_space_device_id_time_idx on _hyper_6_27_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_30_chunk_metrics_space_device_id_time_idx on _hyper_6_30_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (22 rows) RESET enable_hashagg; @@ -2163,6 +2181,7 @@ SELECT time, device_id FROM generate_series('2000-01-01'::timestamptz,'2000-01-21','30m') g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; +VACUUM (ANALYZE) join_limit; -- get 2nd chunk oid SELECT tableoid AS "CHUNK_OID" FROM join_limit WHERE time > '2000-01-07' ORDER BY time LIMIT 1 \gset @@ -2254,7 +2273,7 @@ SELECT table_name FROM create_hypertable('i3030', 'time', create_default_indexes CREATE INDEX ON i3030(a,time); INSERT INTO i3030 (time,a) SELECT time, a FROM generate_series('2000-01-01'::timestamptz,'2000-01-01 3:00:00'::timestamptz,'1min'::interval) time, generate_series(1,30) a; -ANALYZE i3030; +VACUUM (ANALYZE) i3030; :PREFIX SELECT * FROM i3030 where time BETWEEN '2000-01-01'::text::timestamptz AND '2000-01-03'::text::timestamptz ORDER BY a,time LIMIT 1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/test/expected/append-16.out b/test/expected/append-16.out index dd99013f748..a0e03f249cf 100644 --- a/test/expected/append-16.out +++ b/test/expected/append-16.out @@ -57,10 +57,11 @@ INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2 ('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'), ('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'), ('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}'); +VACUUM (ANALYZE) append_test; -- Create another hypertable to join with CREATE TABLE join_test(time timestamptz, temp float, colorid integer); SELECT create_hypertable('join_test', 'time', chunk_time_interval => 2628000000000); -psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column "time" +psql:include/append_load.sql:47: NOTICE: adding not-null constraint to column "time" create_hypertable ------------------------ (2,public,join_test,t) @@ -69,11 +70,13 @@ psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column " INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1), ('2017-02-22T09:18:22', 24.5, 2), ('2017-08-22T09:18:22', 23.1, 3); +VACUUM (ANALYZE) join_test; -- Create another table to join with which is not a hypertable. CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb); INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'), ('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'), ('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}'); +VACUUM (ANALYZE) join_test_plain; -- create hypertable with DATE time dimension CREATE TABLE metrics_date(time DATE NOT NULL); SELECT create_hypertable('metrics_date','time'); @@ -83,18 +86,18 @@ SELECT create_hypertable('metrics_date','time'); (1 row) INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_date; +VACUUM (ANALYZE) metrics_date; -- create hypertable with TIMESTAMP time dimension CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL); SELECT create_hypertable('metrics_timestamp','time'); -psql:include/append_load.sql:67: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices +psql:include/append_load.sql:70: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices create_hypertable -------------------------------- (4,public,metrics_timestamp,t) (1 row) INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_timestamp; +VACUUM (ANALYZE) metrics_timestamp; -- create hypertable with TIMESTAMPTZ time dimension CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL); CREATE INDEX ON metrics_timestamptz(device_id,time); @@ -107,7 +110,7 @@ SELECT create_hypertable('metrics_timestamptz','time'); INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3; -ANALYZE metrics_timestamptz; +VACUUM (ANALYZE) metrics_timestamptz; -- create space partitioned hypertable CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text); SELECT create_hypertable('metrics_space','time','device_id',3); @@ -121,7 +124,7 @@ SELECT time, device_id, device_id + 0.25, device_id + 0.75, device_id FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m'::interval) g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; -ANALYZE metrics_space; +VACUUM (ANALYZE) metrics_space; -- test ChunkAppend projection #2661 CREATE TABLE i2661 ( machine_id int4 NOT NULL, @@ -130,14 +133,14 @@ CREATE TABLE i2661 ( "first" float4 NULL ); SELECT create_hypertable('i2661', 'timestamp'); -psql:include/append_load.sql:99: WARNING: column type "character varying" used for "name" does not follow best practices +psql:include/append_load.sql:102: WARNING: column type "character varying" used for "name" does not follow best practices create_hypertable -------------------- (7,public,i2661,t) (1 row) INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0; -ANALYZE i2661; +VACUUM (ANALYZE) i2661; \ir :TEST_QUERY_NAME -- This file and its contents are licensed under the Apache License 2.0. -- Please see the included NOTICE for copyright information and @@ -162,12 +165,14 @@ psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! - QUERY PLAN ------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) - Order: append_test."time" DESC - Chunks excluded during startup: 3 -(3 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=0 loops=1) + Sort Key: append_test."time" DESC + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) + Chunks excluded during startup: 3 +(5 rows) --query should exclude all chunks and be a MergeAppend :PREFIX @@ -202,12 +207,12 @@ psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------ Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) (4 rows) -- adding ORDER BY and LIMIT should turn the plan into an optimized @@ -223,15 +228,17 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Limit (actual rows=1 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(6 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(8 rows) -- no optimized plan for queries with restrictions that can be -- constified at planning time. Regular planning-time constraint @@ -240,14 +247,16 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! SELECT * FROM append_test WHERE time > now_i() - interval '2 months' ORDER BY time; psql:include/append_query.sql:37: NOTICE: Immutable function now_i() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) +(7 rows) -- currently, we cannot distinguish between stable and volatile -- functions as far as applying our modified plan. However, volatile @@ -261,20 +270,22 @@ psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) -(11 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 0 + -> Seq Scan on _hyper_1_1_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) +(13 rows) -- prepared statement output should be the same regardless of -- optimizations @@ -290,14 +301,16 @@ psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(7 rows) DEALLOCATE query_opt; -- aggregates should produce same output @@ -315,19 +328,22 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! + QUERY PLAN +------------------------------------------------------------------------------------ GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Result (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(10 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (date_trunc('year'::text, append_test."time")) DESC + Sort Method: quicksort + -> Result (actual rows=3 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Chunks excluded during startup: 1 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) +(12 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -358,11 +374,14 @@ SELECT * FROM append_test WHERE time > $1 ORDER BY time; :PREFIX EXECUTE query_param(now_s() - interval '2 months'); psql:include/append_query.sql:82: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) -(2 rows) + QUERY PLAN +------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) +(5 rows) DEALLOCATE query_param; --test with cte @@ -393,8 +412,10 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -410,16 +431,13 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Result (actual rows=5 loops=1) -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(24 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) +(21 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE @@ -446,6 +464,8 @@ psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! btime | value ------------------------------+------- @@ -482,18 +502,18 @@ psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=1 loops=1) Join Filter: (a.colorid = j.colorid) -> Custom Scan (ChunkAppend) on append_test a (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) -> Custom Scan (ChunkAppend) on join_test j (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_2_6_chunk_join_test_time_idx on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) (10 rows) reset enable_hashjoin; @@ -508,13 +528,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -524,13 +544,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -541,13 +561,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -559,13 +579,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -575,13 +595,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -592,13 +612,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -610,10 +630,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -623,10 +643,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -637,10 +657,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamp time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -652,13 +672,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -668,13 +688,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -685,13 +705,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -703,13 +723,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -719,13 +739,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -736,13 +756,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -754,10 +774,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -767,10 +787,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -781,10 +801,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamptz time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -797,13 +817,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -814,13 +834,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -830,13 +850,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test Const OP Var @@ -849,13 +869,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -866,13 +886,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -882,13 +902,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test 2 constraints @@ -901,10 +921,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -915,10 +935,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -928,10 +948,10 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (8 rows) -- test constraint_exclusion with space partitioning and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -956,24 +976,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp ORDER BY time; @@ -996,24 +1016,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz ORDER BY time; @@ -1025,24 +1045,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test Const OP Var @@ -1067,24 +1087,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamp < time ORDER BY time; @@ -1107,24 +1127,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamptz < time ORDER BY time; @@ -1136,24 +1156,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test 2 constraints @@ -1178,24 +1198,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp AND time < '2000-01-15'::timestamp ORDER BY time; @@ -1218,24 +1238,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND time < '2000-01-15'::timestamptz ORDER BY time; @@ -1247,24 +1267,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test filtering on space partition @@ -1275,38 +1295,32 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (1,2) ORDER BY time; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=2304 loops=1) - Order: metrics_space."time" - -> Merge Append (actual rows=1534 loops=1) - Sort Key: _hyper_6_25_chunk."time" - -> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Merge Append (actual rows=770 loops=1) - Sort Key: _hyper_6_28_chunk."time" - -> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 - -> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 -(22 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=2304 loops=1) + Sort Key: _hyper_6_25_chunk."time" + Sort Method: quicksort + -> Append (actual rows=2304 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 +(16 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (VALUES(1)) ORDER BY time; QUERY PLAN @@ -1315,10 +1329,10 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND v3 IN (VALUES('1')) ORDER BY time; @@ -1685,33 +1699,33 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=1 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=26787) Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: ("time" = m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m2_3 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m2_4 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=4611) Index Cond: ("time" = m1."time") - Heap Fetches: 4611 + Heap Fetches: 0 (31 rows) -- test runtime exclusion and startup exclusions @@ -1722,25 +1736,25 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=0 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=0 loops=26787) Chunks excluded during startup: 3 Chunks excluded during runtime: 1 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 3744 + Heap Fetches: 0 (23 rows) -- test runtime exclusion does not activate for constraints on non-partitioning columns @@ -1781,19 +1795,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 5 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 6 + Heap Fetches: 0 (21 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time=g.time) m ON true; @@ -1821,19 +1835,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=3 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 15 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=3 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 18 + Heap Fetches: 0 (19 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time>g.time + '1 day' ORDER BY time LIMIT 1) m ON true; @@ -1848,19 +1862,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 2 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=4) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 4 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 5 + Heap Fetches: 0 (22 rows) -- test runtime exclusion with subquery @@ -1877,7 +1891,7 @@ ORDER BY time DESC, device_id; Order: metrics_timestamptz."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=1 loops=1) Index Cond: ("time" IS NOT NULL) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (never executed) Index Cond: ("time" IS NOT NULL) Heap Fetches: 0 @@ -1904,7 +1918,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=3 loops=1) Index Cond: ("time" = $1) - Heap Fetches: 3 + Heap Fetches: 0 (38 rows) -- test runtime exclusion with correlated subquery @@ -1916,10 +1930,10 @@ ORDER BY time DESC, device_id; Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=3744 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 SubPlan 1 -> Limit (actual rows=1 loops=7776) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=7776) @@ -1936,10 +1950,10 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_4 (actual rows=1 loops=3741) Index Cond: ("time" < m1."time") - Heap Fetches: 3741 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_5 (actual rows=1 loops=4035) Index Cond: ("time" < m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 (29 rows) -- test EXISTS @@ -1951,7 +1965,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=1003 loops=1) Order: m1."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_1 (actual rows=1003 loops=1) - Heap Fetches: 1003 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_2 (never executed) Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (never executed) @@ -1975,7 +1989,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=1003) Index Cond: ("time" > m1."time") - Heap Fetches: 1000 + Heap Fetches: 0 (30 rows) -- test constraint exclusion for subqueries with append @@ -1988,10 +2002,10 @@ ORDER BY time DESC, device_id; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (9 rows) -- test constraint exclusion for subqueries with mergeappend @@ -2006,10 +2020,10 @@ ORDER BY time DESC, device_id; Sort Key: _hyper_5_17_chunk.device_id, _hyper_5_17_chunk."time" -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (11 rows) -- test LIMIT pushdown @@ -2021,7 +2035,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=1 loops=1) Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (never executed) Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (never executed) @@ -2047,21 +2061,23 @@ ORDER BY time DESC, device_id; (8 rows) :PREFIX SELECT count(*) FROM metrics_space LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) -> Append (actual rows=37450 loops=1) -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(12 rows) +(14 rows) -- HAVING should prevent pushdown :PREFIX SELECT 1 FROM metrics_timestamptz HAVING count(*) > 1 LIMIT 1; @@ -2079,8 +2095,8 @@ ORDER BY time DESC, device_id; (9 rows) :PREFIX SELECT 1 FROM metrics_space HAVING count(*) > 1 LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) Filter: (count(*) > 1) @@ -2088,13 +2104,15 @@ ORDER BY time DESC, device_id; -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(13 rows) +(15 rows) -- DISTINCT should prevent pushdown SET enable_hashagg TO false; @@ -2106,15 +2124,15 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=17859 loops=1) Sort Key: _hyper_5_17_chunk.device_id -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=2689 loops=1) - Heap Fetches: 2689 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_19_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_20_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_21_chunk (actual rows=3075 loops=1) - Heap Fetches: 3075 + Heap Fetches: 0 (14 rows) :PREFIX SELECT DISTINCT device_id FROM metrics_space ORDER BY device_id LIMIT 3; @@ -2125,23 +2143,23 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=7491 loops=1) Sort Key: _hyper_6_22_chunk.device_id -> Index Only Scan using _hyper_6_22_chunk_metrics_space_device_id_time_idx on _hyper_6_22_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_23_chunk_metrics_space_device_id_time_idx on _hyper_6_23_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_24_chunk_metrics_space_device_id_time_idx on _hyper_6_24_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_27_chunk_metrics_space_device_id_time_idx on _hyper_6_27_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_30_chunk_metrics_space_device_id_time_idx on _hyper_6_30_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (22 rows) RESET enable_hashagg; @@ -2163,6 +2181,7 @@ SELECT time, device_id FROM generate_series('2000-01-01'::timestamptz,'2000-01-21','30m') g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; +VACUUM (ANALYZE) join_limit; -- get 2nd chunk oid SELECT tableoid AS "CHUNK_OID" FROM join_limit WHERE time > '2000-01-07' ORDER BY time LIMIT 1 \gset @@ -2254,7 +2273,7 @@ SELECT table_name FROM create_hypertable('i3030', 'time', create_default_indexes CREATE INDEX ON i3030(a,time); INSERT INTO i3030 (time,a) SELECT time, a FROM generate_series('2000-01-01'::timestamptz,'2000-01-01 3:00:00'::timestamptz,'1min'::interval) time, generate_series(1,30) a; -ANALYZE i3030; +VACUUM (ANALYZE) i3030; :PREFIX SELECT * FROM i3030 where time BETWEEN '2000-01-01'::text::timestamptz AND '2000-01-03'::text::timestamptz ORDER BY a,time LIMIT 1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/test/expected/append-17.out b/test/expected/append-17.out index 4739f5a7d6d..56ae39cc6d0 100644 --- a/test/expected/append-17.out +++ b/test/expected/append-17.out @@ -57,10 +57,11 @@ INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2 ('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'), ('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'), ('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}'); +VACUUM (ANALYZE) append_test; -- Create another hypertable to join with CREATE TABLE join_test(time timestamptz, temp float, colorid integer); SELECT create_hypertable('join_test', 'time', chunk_time_interval => 2628000000000); -psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column "time" +psql:include/append_load.sql:47: NOTICE: adding not-null constraint to column "time" create_hypertable ------------------------ (2,public,join_test,t) @@ -69,11 +70,13 @@ psql:include/append_load.sql:46: NOTICE: adding not-null constraint to column " INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1), ('2017-02-22T09:18:22', 24.5, 2), ('2017-08-22T09:18:22', 23.1, 3); +VACUUM (ANALYZE) join_test; -- Create another table to join with which is not a hypertable. CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb); INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'), ('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'), ('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}'); +VACUUM (ANALYZE) join_test_plain; -- create hypertable with DATE time dimension CREATE TABLE metrics_date(time DATE NOT NULL); SELECT create_hypertable('metrics_date','time'); @@ -83,18 +86,18 @@ SELECT create_hypertable('metrics_date','time'); (1 row) INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_date; +VACUUM (ANALYZE) metrics_date; -- create hypertable with TIMESTAMP time dimension CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL); SELECT create_hypertable('metrics_timestamp','time'); -psql:include/append_load.sql:67: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices +psql:include/append_load.sql:70: WARNING: column type "timestamp without time zone" used for "time" does not follow best practices create_hypertable -------------------------------- (4,public,metrics_timestamp,t) (1 row) INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_timestamp; +VACUUM (ANALYZE) metrics_timestamp; -- create hypertable with TIMESTAMPTZ time dimension CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL); CREATE INDEX ON metrics_timestamptz(device_id,time); @@ -107,7 +110,7 @@ SELECT create_hypertable('metrics_timestamptz','time'); INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3; -ANALYZE metrics_timestamptz; +VACUUM (ANALYZE) metrics_timestamptz; -- create space partitioned hypertable CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text); SELECT create_hypertable('metrics_space','time','device_id',3); @@ -121,7 +124,7 @@ SELECT time, device_id, device_id + 0.25, device_id + 0.75, device_id FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m'::interval) g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; -ANALYZE metrics_space; +VACUUM (ANALYZE) metrics_space; -- test ChunkAppend projection #2661 CREATE TABLE i2661 ( machine_id int4 NOT NULL, @@ -130,14 +133,14 @@ CREATE TABLE i2661 ( "first" float4 NULL ); SELECT create_hypertable('i2661', 'timestamp'); -psql:include/append_load.sql:99: WARNING: column type "character varying" used for "name" does not follow best practices +psql:include/append_load.sql:102: WARNING: column type "character varying" used for "name" does not follow best practices create_hypertable -------------------- (7,public,i2661,t) (1 row) INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0; -ANALYZE i2661; +VACUUM (ANALYZE) i2661; \ir :TEST_QUERY_NAME -- This file and its contents are licensed under the Apache License 2.0. -- Please see the included NOTICE for copyright information and @@ -162,12 +165,14 @@ psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! psql:include/append_query.sql:12: NOTICE: Stable function now_s() called! - QUERY PLAN ------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) - Order: append_test."time" DESC - Chunks excluded during startup: 3 -(3 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=0 loops=1) + Sort Key: append_test."time" DESC + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=0 loops=1) + Chunks excluded during startup: 3 +(5 rows) --query should exclude all chunks and be a MergeAppend :PREFIX @@ -202,12 +207,12 @@ psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! psql:include/append_query.sql:24: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------ Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) (4 rows) -- adding ORDER BY and LIMIT should turn the plan into an optimized @@ -223,15 +228,17 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Limit (actual rows=1 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(6 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(8 rows) -- no optimized plan for queries with restrictions that can be -- constified at planning time. Regular planning-time constraint @@ -240,14 +247,16 @@ psql:include/append_query.sql:30: NOTICE: Stable function now_s() called! SELECT * FROM append_test WHERE time > now_i() - interval '2 months' ORDER BY time; psql:include/append_query.sql:37: NOTICE: Immutable function now_i() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > ('Tue Aug 22 10:00:00 2017 PDT'::timestamp with time zone - '@ 2 mons'::interval)) +(7 rows) -- currently, we cannot distinguish between stable and volatile -- functions as far as applying our modified plan. However, volatile @@ -261,20 +270,22 @@ psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! psql:include/append_query.sql:45: NOTICE: Volatile function now_v() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=0 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Filter: ("time" > (now_v() - '@ 2 mons'::interval)) -(11 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 0 + -> Seq Scan on _hyper_1_1_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) + Rows Removed by Filter: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_v() - '@ 2 mons'::interval)) +(13 rows) -- prepared statement output should be the same regardless of -- optimizations @@ -290,14 +301,16 @@ psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! psql:include/append_query.sql:53: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) - Order: append_test."time" - Chunks excluded during startup: 2 - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 2 mons'::interval)) -(5 rows) + QUERY PLAN +------------------------------------------------------------------------ + Sort (actual rows=1 loops=1) + Sort Key: append_test."time" + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=1 loops=1) + Chunks excluded during startup: 2 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 2 mons'::interval)) +(7 rows) DEALLOCATE query_opt; -- aggregates should produce same output @@ -315,19 +328,22 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! + QUERY PLAN +------------------------------------------------------------------------------------ GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Result (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(10 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (date_trunc('year'::text, append_test."time")) DESC + Sort Method: quicksort + -> Result (actual rows=3 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Chunks excluded during startup: 1 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ("time" > (now_s() - '@ 4 mons'::interval)) +(12 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -358,11 +374,14 @@ SELECT * FROM append_test WHERE time > $1 ORDER BY time; :PREFIX EXECUTE query_param(now_s() - interval '2 months'); psql:include/append_query.sql:82: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------- - Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) -(2 rows) + QUERY PLAN +------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ("time" > 'Thu Jun 22 10:00:00 2017 PDT'::timestamp with time zone) +(5 rows) DEALLOCATE query_param; --test with cte @@ -393,8 +412,10 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -410,16 +431,13 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Result (actual rows=5 loops=1) -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(24 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + Filter: ((colorid > 0) AND ("time" > (now_s() - '@ 400 days'::interval))) +(21 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE @@ -446,6 +464,8 @@ psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! +psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! psql:include/append_query.sql:119: NOTICE: Stable function now_s() called! btime | value ------------------------------+------- @@ -482,18 +502,18 @@ psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! psql:include/append_query.sql:130: NOTICE: Stable function now_s() called! - QUERY PLAN --------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------- Nested Loop (actual rows=1 loops=1) Join Filter: (a.colorid = j.colorid) -> Custom Scan (ChunkAppend) on append_test a (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_1_3_chunk a_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) -> Custom Scan (ChunkAppend) on join_test j (actual rows=1 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_2_6_chunk_join_test_time_idx on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 3 hours'::interval)) + -> Seq Scan on _hyper_2_6_chunk j_1 (actual rows=1 loops=1) + Filter: ("time" > (now_s() - '@ 3 hours'::interval)) (10 rows) reset enable_hashjoin; @@ -508,13 +528,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -524,13 +544,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -541,13 +561,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -559,13 +579,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -575,13 +595,13 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_date WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -592,13 +612,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_11_chunk_metrics_date_time_idx on _hyper_3_11_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -610,10 +630,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -623,10 +643,10 @@ reset enable_material; Order: metrics_date."time" -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_date WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -637,10 +657,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_3_9_chunk_metrics_date_time_idx on _hyper_3_9_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_3_10_chunk_metrics_date_time_idx on _hyper_3_10_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamp time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -652,13 +672,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -668,13 +688,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -685,13 +705,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test Const OP Var @@ -703,13 +723,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -719,13 +739,13 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (11 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -736,13 +756,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=2016 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 2016 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_16_chunk_metrics_timestamp_time_idx on _hyper_4_16_chunk (actual rows=1441 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1441 + Heap Fetches: 0 (12 rows) -- test 2 constraints @@ -754,10 +774,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -767,10 +787,10 @@ reset enable_material; Order: metrics_timestamp."time" -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (8 rows) :PREFIX SELECT * FROM metrics_timestamp WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -781,10 +801,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_4_14_chunk_metrics_timestamp_time_idx on _hyper_4_14_chunk (actual rows=1439 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1439 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_4_15_chunk_metrics_timestamp_time_idx on _hyper_4_15_chunk (actual rows=288 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 288 + Heap Fetches: 0 (9 rows) -- test constraint_exclusion with timestamptz time dimension and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -797,13 +817,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp ORDER BY time; @@ -814,13 +834,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz ORDER BY time; @@ -830,13 +850,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test Const OP Var @@ -849,13 +869,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > '01-15-2000'::date) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamp < time ORDER BY time; @@ -866,13 +886,13 @@ reset enable_material; Chunks excluded during startup: 2 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (12 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE '2000-01-15'::timestamptz < time ORDER BY time; @@ -882,13 +902,13 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=6048 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=4611 loops=1) Index Cond: ("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4611 + Heap Fetches: 0 (11 rows) -- test 2 constraints @@ -901,10 +921,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > '01-15-2000'::date) AND ("time" < '01-21-2000'::date)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamp AND time < '2000-01-21'::timestamp ORDER BY time; @@ -915,10 +935,10 @@ reset enable_material; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (9 rows) :PREFIX SELECT time FROM metrics_timestamptz WHERE time > '2000-01-15'::timestamptz AND time < '2000-01-21'::timestamptz ORDER BY time; @@ -928,10 +948,10 @@ reset enable_material; Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (actual rows=4029 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 4029 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (actual rows=1152 loops=1) Index Cond: (("time" > 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Fri Jan 21 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1152 + Heap Fetches: 0 (8 rows) -- test constraint_exclusion with space partitioning and DATE/TIMESTAMP/TIMESTAMPTZ constraints @@ -956,24 +976,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp ORDER BY time; @@ -996,24 +1016,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz ORDER BY time; @@ -1025,24 +1045,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test Const OP Var @@ -1067,24 +1087,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > '01-10-2000'::date) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamp < time ORDER BY time; @@ -1107,24 +1127,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE '2000-01-10'::timestamptz < time ORDER BY time; @@ -1136,24 +1156,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test 2 constraints @@ -1178,24 +1198,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > '01-10-2000'::date) AND ("time" < '01-15-2000'::date)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamp AND time < '2000-01-15'::timestamp ORDER BY time; @@ -1218,24 +1238,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000'::timestamp without time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000'::timestamp without time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (35 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND time < '2000-01-15'::timestamptz ORDER BY time; @@ -1247,24 +1267,24 @@ reset enable_material; Sort Key: _hyper_6_25_chunk."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=3068 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 3068 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_27_chunk_metrics_space_time_idx on _hyper_6_27_chunk (actual rows=1534 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1534 + Heap Fetches: 0 -> Merge Append (actual rows=3850 loops=1) Sort Key: _hyper_6_28_chunk."time" -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=1540 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 1540 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_30_chunk_metrics_space_time_idx on _hyper_6_30_chunk (actual rows=770 loops=1) Index Cond: (("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Sat Jan 15 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 770 + Heap Fetches: 0 (24 rows) -- test filtering on space partition @@ -1275,38 +1295,32 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (1,2) ORDER BY time; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=2304 loops=1) - Order: metrics_space."time" - -> Merge Append (actual rows=1534 loops=1) - Sort Key: _hyper_6_25_chunk."time" - -> Index Scan Backward using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Index Scan Backward using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2301 - -> Merge Append (actual rows=770 loops=1) - Sort Key: _hyper_6_28_chunk."time" - -> Index Scan Backward using _hyper_6_28_chunk_metrics_space_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 - -> Index Scan Backward using _hyper_6_29_chunk_metrics_space_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) - Index Cond: ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1155 -(22 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=2304 loops=1) + Sort Key: _hyper_6_25_chunk."time" + Sort Method: quicksort + -> Append (actual rows=2304 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=767 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=385 loops=1) + Index Cond: ((device_id = ANY ('{1,2}'::integer[])) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) + Heap Fetches: 0 +(16 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND device_id IN (VALUES(1)) ORDER BY time; QUERY PLAN @@ -1315,10 +1329,10 @@ reset enable_material; Order: metrics_space."time" -> Index Only Scan Backward using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=767 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 767 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=385 loops=1) Index Cond: ((device_id = 1) AND ("time" > 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone)) - Heap Fetches: 385 + Heap Fetches: 0 (8 rows) :PREFIX SELECT time FROM metrics_space WHERE time > '2000-01-10'::timestamptz AND v3 IN (VALUES('1')) ORDER BY time; @@ -1685,33 +1699,33 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=1 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=26787) Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: ("time" = m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m2_3 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m2_4 (actual rows=1 loops=6048) Index Cond: ("time" = m1."time") - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=4611) Index Cond: ("time" = m1."time") - Heap Fetches: 4611 + Heap Fetches: 0 (31 rows) -- test runtime exclusion and startup exclusions @@ -1722,25 +1736,25 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=26787 loops=1) Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_4 (actual rows=6048 loops=1) - Heap Fetches: 6048 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=4611 loops=1) - Heap Fetches: 4611 + Heap Fetches: 0 -> Limit (actual rows=0 loops=26787) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=0 loops=26787) Chunks excluded during startup: 3 Chunks excluded during runtime: 1 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_1 (actual rows=1 loops=4032) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_2 (actual rows=1 loops=6048) Index Cond: (("time" < ('2000-01-10'::cstring)::timestamp with time zone) AND ("time" = m1."time")) - Heap Fetches: 3744 + Heap Fetches: 0 (23 rows) -- test runtime exclusion does not activate for constraints on non-partitioning columns @@ -1781,19 +1795,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 5 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 6 + Heap Fetches: 0 (21 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time=g.time) m ON true; @@ -1821,19 +1835,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 4 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=3 loops=5) Index Cond: ("time" = g."time") - Heap Fetches: 15 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=3 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 21 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=3 loops=6) Index Cond: ("time" = g."time") - Heap Fetches: 18 + Heap Fetches: 0 (19 rows) :PREFIX SELECT * FROM generate_series('2000-01-01'::timestamptz,'2000-02-01'::timestamptz,'1d'::interval) AS g(time) INNER JOIN LATERAL (SELECT time FROM metrics_timestamptz m WHERE time>g.time + '1 day' ORDER BY time LIMIT 1) m ON true; @@ -1848,19 +1862,19 @@ ORDER BY time DESC, device_id; Chunks excluded during runtime: 2 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m_1 (actual rows=1 loops=4) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 4 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m_2 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m_3 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m_4 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m_5 (actual rows=1 loops=7) Index Cond: ("time" > (g."time" + '@ 1 day'::interval)) - Heap Fetches: 5 + Heap Fetches: 0 (22 rows) -- test runtime exclusion with subquery @@ -1876,7 +1890,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=1 loops=1) Order: metrics_timestamptz."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk (never executed) Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (never executed) @@ -1899,7 +1913,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_5 (actual rows=3 loops=1) Index Cond: ("time" = (InitPlan 2).col1) - Heap Fetches: 3 + Heap Fetches: 0 (33 rows) -- test runtime exclusion with correlated subquery @@ -1911,10 +1925,10 @@ ORDER BY time DESC, device_id; Order: m1."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m1_1 (actual rows=4032 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m1_2 (actual rows=3744 loops=1) Index Cond: ("time" < 'Mon Jan 10 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 SubPlan 1 -> Limit (actual rows=1 loops=7776) -> Custom Scan (ChunkAppend) on metrics_timestamptz m2 (actual rows=1 loops=7776) @@ -1931,10 +1945,10 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk m2_4 (actual rows=1 loops=3741) Index Cond: ("time" < m1."time") - Heap Fetches: 3741 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk m2_5 (actual rows=1 loops=4035) Index Cond: ("time" < m1."time") - Heap Fetches: 4032 + Heap Fetches: 0 (29 rows) -- test EXISTS @@ -1946,7 +1960,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz m1 (actual rows=1003 loops=1) Order: m1."time" DESC -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m1_1 (actual rows=1003 loops=1) - Heap Fetches: 1003 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_time_idx on _hyper_5_20_chunk m1_2 (never executed) Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk m1_3 (never executed) @@ -1970,7 +1984,7 @@ ORDER BY time DESC, device_id; Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_time_idx on _hyper_5_21_chunk m2_5 (actual rows=1 loops=1003) Index Cond: ("time" > m1."time") - Heap Fetches: 1000 + Heap Fetches: 0 (30 rows) -- test constraint exclusion for subqueries with append @@ -1983,10 +1997,10 @@ ORDER BY time DESC, device_id; Chunks excluded during startup: 3 -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (9 rows) -- test constraint exclusion for subqueries with mergeappend @@ -2001,10 +2015,10 @@ ORDER BY time DESC, device_id; Sort Key: _hyper_5_17_chunk.device_id, _hyper_5_17_chunk."time" -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=4032 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 4032 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=3744 loops=1) Index Cond: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - Heap Fetches: 3744 + Heap Fetches: 0 (11 rows) -- test LIMIT pushdown @@ -2016,7 +2030,7 @@ ORDER BY time DESC, device_id; -> Custom Scan (ChunkAppend) on metrics_timestamptz (actual rows=1 loops=1) Order: metrics_timestamptz."time" -> Index Only Scan Backward using _hyper_5_17_chunk_metrics_timestamptz_time_idx on _hyper_5_17_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_18_chunk_metrics_timestamptz_time_idx on _hyper_5_18_chunk (never executed) Heap Fetches: 0 -> Index Only Scan Backward using _hyper_5_19_chunk_metrics_timestamptz_time_idx on _hyper_5_19_chunk (never executed) @@ -2042,21 +2056,23 @@ ORDER BY time DESC, device_id; (8 rows) :PREFIX SELECT count(*) FROM metrics_space LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) -> Append (actual rows=37450 loops=1) -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(12 rows) +(14 rows) -- HAVING should prevent pushdown :PREFIX SELECT 1 FROM metrics_timestamptz HAVING count(*) > 1 LIMIT 1; @@ -2074,8 +2090,8 @@ ORDER BY time DESC, device_id; (9 rows) :PREFIX SELECT 1 FROM metrics_space HAVING count(*) > 1 LIMIT 1; - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Aggregate (actual rows=1 loops=1) Filter: (count(*) > 1) @@ -2083,13 +2099,15 @@ ORDER BY time DESC, device_id; -> Seq Scan on _hyper_6_22_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_23_chunk (actual rows=5376 loops=1) -> Seq Scan on _hyper_6_24_chunk (actual rows=2688 loops=1) - -> Seq Scan on _hyper_6_25_chunk (actual rows=8064 loops=1) - -> Seq Scan on _hyper_6_26_chunk (actual rows=8064 loops=1) + -> Index Only Scan using _hyper_6_25_chunk_metrics_space_time_idx on _hyper_6_25_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 + -> Index Only Scan using _hyper_6_26_chunk_metrics_space_time_idx on _hyper_6_26_chunk (actual rows=8064 loops=1) + Heap Fetches: 0 -> Seq Scan on _hyper_6_27_chunk (actual rows=4032 loops=1) -> Seq Scan on _hyper_6_28_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_29_chunk (actual rows=1540 loops=1) -> Seq Scan on _hyper_6_30_chunk (actual rows=770 loops=1) -(13 rows) +(15 rows) -- DISTINCT should prevent pushdown SET enable_hashagg TO false; @@ -2101,15 +2119,15 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=17859 loops=1) Sort Key: _hyper_5_17_chunk.device_id -> Index Only Scan using _hyper_5_17_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_17_chunk (actual rows=2689 loops=1) - Heap Fetches: 2689 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_18_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_18_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_19_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_19_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_20_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_20_chunk (actual rows=4033 loops=1) - Heap Fetches: 4033 + Heap Fetches: 0 -> Index Only Scan using _hyper_5_21_chunk_metrics_timestamptz_device_id_time_idx on _hyper_5_21_chunk (actual rows=3075 loops=1) - Heap Fetches: 3075 + Heap Fetches: 0 (14 rows) :PREFIX SELECT DISTINCT device_id FROM metrics_space ORDER BY device_id LIMIT 3; @@ -2120,23 +2138,23 @@ SET enable_hashagg TO false; -> Merge Append (actual rows=7491 loops=1) Sort Key: _hyper_6_22_chunk.device_id -> Index Only Scan using _hyper_6_22_chunk_metrics_space_device_id_time_idx on _hyper_6_22_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_23_chunk_metrics_space_device_id_time_idx on _hyper_6_23_chunk (actual rows=1345 loops=1) - Heap Fetches: 1345 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_24_chunk_metrics_space_device_id_time_idx on _hyper_6_24_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_25_chunk_metrics_space_device_id_time_idx on _hyper_6_25_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_26_chunk_metrics_space_device_id_time_idx on _hyper_6_26_chunk (actual rows=2017 loops=1) - Heap Fetches: 2017 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_27_chunk_metrics_space_device_id_time_idx on _hyper_6_27_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_28_chunk_metrics_space_device_id_time_idx on _hyper_6_28_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_29_chunk_metrics_space_device_id_time_idx on _hyper_6_29_chunk (actual rows=386 loops=1) - Heap Fetches: 386 + Heap Fetches: 0 -> Index Only Scan using _hyper_6_30_chunk_metrics_space_device_id_time_idx on _hyper_6_30_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (22 rows) RESET enable_hashagg; @@ -2158,6 +2176,7 @@ SELECT time, device_id FROM generate_series('2000-01-01'::timestamptz,'2000-01-21','30m') g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; +VACUUM (ANALYZE) join_limit; -- get 2nd chunk oid SELECT tableoid AS "CHUNK_OID" FROM join_limit WHERE time > '2000-01-07' ORDER BY time LIMIT 1 \gset @@ -2249,7 +2268,7 @@ SELECT table_name FROM create_hypertable('i3030', 'time', create_default_indexes CREATE INDEX ON i3030(a,time); INSERT INTO i3030 (time,a) SELECT time, a FROM generate_series('2000-01-01'::timestamptz,'2000-01-01 3:00:00'::timestamptz,'1min'::interval) time, generate_series(1,30) a; -ANALYZE i3030; +VACUUM (ANALYZE) i3030; :PREFIX SELECT * FROM i3030 where time BETWEEN '2000-01-01'::text::timestamptz AND '2000-01-03'::text::timestamptz ORDER BY a,time LIMIT 1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/test/sql/include/append_load.sql b/test/sql/include/append_load.sql index 119e095351c..17e16887e8a 100644 --- a/test/sql/include/append_load.sql +++ b/test/sql/include/append_load.sql @@ -40,6 +40,7 @@ INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2 ('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'), ('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'), ('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}'); +VACUUM (ANALYZE) append_test; -- Create another hypertable to join with CREATE TABLE join_test(time timestamptz, temp float, colorid integer); @@ -48,6 +49,7 @@ SELECT create_hypertable('join_test', 'time', chunk_time_interval => 26280000000 INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1), ('2017-02-22T09:18:22', 24.5, 2), ('2017-08-22T09:18:22', 23.1, 3); +VACUUM (ANALYZE) join_test; -- Create another table to join with which is not a hypertable. CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb); @@ -55,18 +57,19 @@ CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'), ('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'), ('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}'); +VACUUM (ANALYZE) join_test_plain; -- create hypertable with DATE time dimension CREATE TABLE metrics_date(time DATE NOT NULL); SELECT create_hypertable('metrics_date','time'); INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_date; +VACUUM (ANALYZE) metrics_date; -- create hypertable with TIMESTAMP time dimension CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL); SELECT create_hypertable('metrics_timestamp','time'); INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval); -ANALYZE metrics_timestamp; +VACUUM (ANALYZE) metrics_timestamp; -- create hypertable with TIMESTAMPTZ time dimension CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL); @@ -75,7 +78,7 @@ SELECT create_hypertable('metrics_timestamptz','time'); INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2; INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3; -ANALYZE metrics_timestamptz; +VACUUM (ANALYZE) metrics_timestamptz; -- create space partitioned hypertable CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text); @@ -87,7 +90,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m': generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; -ANALYZE metrics_space; +VACUUM (ANALYZE) metrics_space; -- test ChunkAppend projection #2661 CREATE TABLE i2661 ( @@ -99,5 +102,4 @@ CREATE TABLE i2661 ( SELECT create_hypertable('i2661', 'timestamp'); INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0; -ANALYZE i2661; - +VACUUM (ANALYZE) i2661; diff --git a/test/sql/include/append_query.sql b/test/sql/include/append_query.sql index 0da66c55a1b..f7629f77659 100644 --- a/test/sql/include/append_query.sql +++ b/test/sql/include/append_query.sql @@ -320,6 +320,7 @@ SELECT time, device_id FROM generate_series('2000-01-01'::timestamptz,'2000-01-21','30m') g1(time), generate_series(1,10,1) g2(device_id) ORDER BY time, device_id; +VACUUM (ANALYZE) join_limit; -- get 2nd chunk oid SELECT tableoid AS "CHUNK_OID" FROM join_limit WHERE time > '2000-01-07' ORDER BY time LIMIT 1 @@ -353,7 +354,7 @@ CREATE TABLE i3030(time timestamptz NOT NULL, a int, b int); SELECT table_name FROM create_hypertable('i3030', 'time', create_default_indexes=>false); CREATE INDEX ON i3030(a,time); INSERT INTO i3030 (time,a) SELECT time, a FROM generate_series('2000-01-01'::timestamptz,'2000-01-01 3:00:00'::timestamptz,'1min'::interval) time, generate_series(1,30) a; -ANALYZE i3030; +VACUUM (ANALYZE) i3030; :PREFIX SELECT * FROM i3030 where time BETWEEN '2000-01-01'::text::timestamptz AND '2000-01-03'::text::timestamptz ORDER BY a,time LIMIT 1; DROP TABLE i3030; From 4cc15b35e789373bea018c518b866b0ca2463b0b Mon Sep 17 00:00:00 2001 From: Iain Cox Date: Wed, 4 Dec 2024 16:40:42 +0100 Subject: [PATCH 5/7] Update README.md Signed-off-by: Iain Cox --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c26018f8a7..9114f89ab80 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@
-

TimescaleDB is an extension for PostgreSQL that enables time-series, events, and analytics workloads, while increasing ingest, query, and storage performance

+

TimescaleDB is an extension for PostgreSQL that enables time-series, events, and real-time analytics workloads, while increasing ingest, query, and storage performance

[![Docs](https://img.shields.io/badge/Read_the_Timescale_docs-black?style=for-the-badge&logo=readthedocs&logoColor=white)](https://docs.timescale.com/) [![SLACK](https://img.shields.io/badge/Ask_the_Timescale_community-black?style=for-the-badge&logo=slack&logoColor=white)](https://timescaledb.slack.com/archives/C4GT3N90X) From 6294a07f818ab45d1b85b5fa840477b1168837a7 Mon Sep 17 00:00:00 2001 From: Iain Cox Date: Thu, 5 Dec 2024 15:22:22 +0100 Subject: [PATCH 6/7] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fabrízio de Royes Mello Signed-off-by: Iain Cox --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9114f89ab80..d95ec02afbe 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ For example, calculate the average daily temperature in a table named `weather_c ```sql SELECT time_bucket('1 day', time) AS bucket, avg(temperature) AS avg_temp -FROM weather_conditions +FROM conditions GROUP BY bucket ORDER BY bucket ASC; ``` From c205a027e205e6b01ba8805fa45ef4358cc21193 Mon Sep 17 00:00:00 2001 From: Iain Cox Date: Fri, 6 Dec 2024 15:00:36 +0100 Subject: [PATCH 7/7] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fabrízio de Royes Mello Signed-off-by: Iain Cox --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d95ec02afbe..93b6b4946d8 100644 --- a/README.md +++ b/README.md @@ -115,16 +115,23 @@ You compress your time-series data to reduce its size by more than 90%. This cut When you enable compression, the data in your hypertable is compressed chunk by chunk. When the chunk is compressed, multiple records are grouped into a single row. The columns of this row hold an array-like structure that stores all the data. This means that instead of using lots of rows to store the data, it stores the same data in a single row. Because a single row takes up less disk space than many rows, it decreases the amount of disk space required, and can also speed up your queries. For example: -- Compress a specific hypertable chunk manually: +- Enable compression on hypertable + ```sql + ALTER TABLE conditions SET ( + timescaledb.compress, + timescaledb.compress_segmentby = 'device_id' + ); + ``` +- Compress hypertable chunks manually: ```sql - SELECT compress_chunk( ''); + SELECT compress_chunk(chunk, if_not_compressed => true) FROM show_chunks( 'conditions', now()::timestamp - INTERVAL '1 week', now()::timestamp - INTERVAL '3 weeks' ) AS chunk; ``` - Create a policy to compress chunks that are older than seven days automatically: ```sql - SELECT add_compression_policy('', INTERVAL '7 days'); + SELECT add_compression_policy('conditions', INTERVAL '7 days'); ``` See more: