diff --git a/.unreleased/pr_6513 b/.unreleased/pr_6513 new file mode 100644 index 00000000000..9f1ef76ac3c --- /dev/null +++ b/.unreleased/pr_6513 @@ -0,0 +1 @@ +Implements: #6513 Make compression settings per chunk diff --git a/cmake/ScriptFiles.cmake b/cmake/ScriptFiles.cmake index 589ab98220c..2ccc68b3c31 100644 --- a/cmake/ScriptFiles.cmake +++ b/cmake/ScriptFiles.cmake @@ -31,7 +31,6 @@ set(SOURCE_FILES util_time.sql util_internal_table_ddl.sql chunk_constraint.sql - hypertable_constraint.sql partitioning.sql ddl_api.sql ddl_triggers.sql diff --git a/sql/chunk_constraint.sql b/sql/chunk_constraint.sql index 1d205b236fe..9431263ddfd 100644 --- a/sql/chunk_constraint.sql +++ b/sql/chunk_constraint.sql @@ -74,3 +74,29 @@ BEGIN END IF; END $BODY$ SET search_path TO pg_catalog, pg_temp; + +-- Clone fk constraint from a hypertable to a compressed chunk +CREATE OR REPLACE FUNCTION _timescaledb_functions.constraint_clone( + constraint_oid OID, + target_oid REGCLASS +) + RETURNS VOID LANGUAGE PLPGSQL AS +$BODY$ +DECLARE + constraint_name NAME; + def TEXT; +BEGIN + def := pg_get_constraintdef(constraint_oid); + SELECT conname INTO STRICT constraint_name FROM pg_constraint WHERE oid = constraint_oid; + + IF def IS NULL THEN + RAISE 'constraint not found'; + END IF; + + -- to allow for custom types with operators outside of pg_catalog + -- we set search_path to @extschema@ + SET LOCAL search_path TO @extschema@, pg_temp; + EXECUTE pg_catalog.format($$ ALTER TABLE %s ADD CONSTRAINT %I %s $$, target_oid::pg_catalog.text, constraint_name, def); + +END +$BODY$ SET search_path TO pg_catalog, pg_temp; diff --git a/sql/compat.sql b/sql/compat.sql index cc06049f8e8..b3811f379c9 100644 --- a/sql/compat.sql +++ b/sql/compat.sql @@ -348,16 +348,6 @@ END$$ SET search_path TO pg_catalog,pg_temp; -CREATE OR REPLACE FUNCTION _timescaledb_internal.hypertable_constraint_add_table_fk_constraint(user_ht_constraint_name name,user_ht_schema_name name,user_ht_table_name name,compress_ht_id integer) RETURNS void LANGUAGE PLPGSQL AS $$ -BEGIN - IF current_setting('timescaledb.enable_deprecation_warnings', true)::bool THEN - RAISE WARNING 'function _timescaledb_internal.hypertable_constraint_add_table_fk_constraint(name,name,name,integer) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version.'; - END IF; - PERFORM _timescaledb_functions.hypertable_constraint_add_table_fk_constraint($1,$2,$3,$4); -END$$ -SET search_path TO pg_catalog,pg_temp; - - CREATE OR REPLACE FUNCTION _timescaledb_internal.hypertable_invalidation_log_delete(raw_hypertable_id integer) RETURNS void LANGUAGE PLPGSQL AS $$ BEGIN IF current_setting('timescaledb.enable_deprecation_warnings', true)::bool THEN diff --git a/sql/hypertable_constraint.sql b/sql/hypertable_constraint.sql deleted file mode 100644 index 8f8e4b0a89d..00000000000 --- a/sql/hypertable_constraint.sql +++ /dev/null @@ -1,41 +0,0 @@ --- This file and its contents are licensed under the Apache License 2.0. --- Please see the included NOTICE for copyright information and --- LICENSE-APACHE for a copy of the license. - --- Clone fk constraint from a hypertable -CREATE OR REPLACE FUNCTION _timescaledb_functions.hypertable_constraint_add_table_fk_constraint( - user_ht_constraint_name NAME, - user_ht_schema_name NAME, - user_ht_table_name NAME, - compress_ht_id INTEGER -) - RETURNS VOID LANGUAGE PLPGSQL AS -$BODY$ -DECLARE - compressed_ht_row _timescaledb_catalog.hypertable; - constraint_oid OID; - check_sql TEXT; - def TEXT; -BEGIN - SELECT * INTO STRICT compressed_ht_row FROM _timescaledb_catalog.hypertable h - WHERE h.id = compress_ht_id; - IF user_ht_constraint_name IS NOT NULL THEN - SELECT oid INTO STRICT constraint_oid FROM pg_constraint - WHERE conname=user_ht_constraint_name AND contype = 'f' AND - conrelid = format('%I.%I', user_ht_schema_name, user_ht_table_name)::regclass::oid; - def := pg_get_constraintdef(constraint_oid); - ELSE - RAISE 'unknown constraint type'; - END IF; - IF def IS NOT NULL THEN - -- to allow for custom types with operators outside of pg_catalog - -- we set search_path to @extschema@ - SET LOCAL search_path TO @extschema@, pg_temp; - EXECUTE pg_catalog.format( - $$ ALTER TABLE %I.%I ADD CONSTRAINT %I %s $$, - compressed_ht_row.schema_name, compressed_ht_row.table_name, user_ht_constraint_name, def - ); - END IF; - -END -$BODY$ SET search_path TO pg_catalog, pg_temp; diff --git a/sql/updates/latest-dev.sql b/sql/updates/latest-dev.sql index 2b549a4698f..326cab86772 100644 --- a/sql/updates/latest-dev.sql +++ b/sql/updates/latest-dev.sql @@ -83,7 +83,7 @@ DROP FUNCTION IF EXISTS @extschema@.create_distributed_restore_point; DROP FUNCTION IF EXISTS @extschema@.set_replication_factor; CREATE TABLE _timescaledb_catalog.compression_settings ( - relid regclass NOT NULL, + relid regclass NOT NULL, segmentby text[], orderby text[], orderby_desc bool[], @@ -102,8 +102,8 @@ INSERT INTO _timescaledb_catalog.compression_settings(relid, segmentby, orderby, array_agg(NOT orderby_asc ORDER BY orderby_column_index) FILTER(WHERE orderby_column_index >= 1) AS compress_orderby_desc, array_agg(orderby_nullsfirst ORDER BY orderby_column_index) FILTER(WHERE orderby_column_index >= 1) AS compress_orderby_nullsfirst FROM _timescaledb_catalog.hypertable_compression hc - INNER JOIN _timescaledb_catalog.hypertable ht ON ht.id = hc.hypertable_id - GROUP BY hypertable_id, ht.schema_name, ht.table_name; + INNER JOIN _timescaledb_catalog.hypertable ht ON ht.id = hc.hypertable_id + GROUP BY hypertable_id, ht.schema_name, ht.table_name; GRANT SELECT ON _timescaledb_catalog.compression_settings TO PUBLIC; SELECT pg_catalog.pg_extension_config_dump('_timescaledb_catalog.compression_settings', ''); @@ -325,3 +325,72 @@ ALTER TABLE _timescaledb_catalog.tablespace ADD CONSTRAINT tablespace_hypertable_id_fkey FOREIGN KEY (hypertable_id) REFERENCES _timescaledb_catalog.hypertable(id) ON DELETE CASCADE; CREATE SCHEMA _timescaledb_debug; + +-- Migrate existing compressed hypertables to new internal format +DO $$ +DECLARE + chunk regclass; + hypertable regclass; + ht_id integer; + index regclass; + column_name name; + cmd text; +BEGIN + SET timescaledb.restoring TO ON; + + -- Detach compressed chunks from their parent hypertables + FOR chunk, hypertable, ht_id IN + SELECT + format('%I.%I',ch.schema_name,ch.table_name)::regclass chunk, + format('%I.%I',ht.schema_name,ht.table_name)::regclass hypertable, + ht.id + FROM _timescaledb_catalog.chunk ch + INNER JOIN _timescaledb_catalog.hypertable ht_uncomp + ON ch.hypertable_id = ht_uncomp.compressed_hypertable_id + INNER JOIN _timescaledb_catalog.hypertable ht + ON ht.id = ht_uncomp.compressed_hypertable_id + LOOP + + cmd := format('ALTER TABLE %s NO INHERIT %s', chunk, hypertable); + EXECUTE cmd; + -- remove references to indexes from the compressed hypertable + DELETE FROM _timescaledb_catalog.chunk_index WHERE hypertable_id = ht_id; + + END LOOP; + + + FOR hypertable IN + SELECT + format('%I.%I',ht.schema_name,ht.table_name)::regclass hypertable + FROM _timescaledb_catalog.hypertable ht_uncomp + INNER JOIN _timescaledb_catalog.hypertable ht + ON ht.id = ht_uncomp.compressed_hypertable_id + LOOP + + -- remove indexes from the compressed hypertable (but not chunks) + FOR index IN + SELECT indexrelid::regclass FROM pg_index WHERE indrelid = hypertable + LOOP + cmd := format('DROP INDEX %s', index); + EXECUTE cmd; + END LOOP; + + -- remove columns from the compressed hypertable (but not chunks) + FOR column_name IN + SELECT attname FROM pg_attribute WHERE attrelid = hypertable AND attnum > 0 + LOOP + cmd := format('ALTER TABLE %s DROP COLUMN %I', hypertable, column_name); + EXECUTE cmd; + END LOOP; + + END LOOP; + + SET timescaledb.restoring TO OFF; +END $$; + +DROP FUNCTION IF EXISTS _timescaledb_internal.hypertable_constraint_add_table_fk_constraint; +DROP FUNCTION IF EXISTS _timescaledb_functions.hypertable_constraint_add_table_fk_constraint; + +-- only define stub here, actual code will be filled in at end of update script +CREATE FUNCTION _timescaledb_functions.constraint_clone(constraint_oid OID,target_oid REGCLASS) RETURNS VOID LANGUAGE PLPGSQL AS $$BEGIN END$$ SET search_path TO pg_catalog, pg_temp; + diff --git a/sql/updates/reverse-dev.sql b/sql/updates/reverse-dev.sql index 1e4eae2f35c..979f34fe566 100644 --- a/sql/updates/reverse-dev.sql +++ b/sql/updates/reverse-dev.sql @@ -1,3 +1,136 @@ +-- check whether we can safely downgrade compression setup +DO $$ +DECLARE + hypertable regclass; + ht_uncomp regclass; + chunk_relids oid[]; + ht_id integer; +BEGIN + + FOR hypertable, ht_uncomp, ht_id IN + SELECT + format('%I.%I',ht.schema_name,ht.table_name)::regclass, + format('%I.%I',ht_uncomp.schema_name,ht_uncomp.table_name)::regclass, + ht.id + FROM _timescaledb_catalog.hypertable ht_uncomp + INNER JOIN _timescaledb_catalog.hypertable ht + ON ht.id = ht_uncomp.compressed_hypertable_id + LOOP + + -- hypertables need to at least have 1 compressed chunk so we can restore the columns + IF NOT EXISTS(SELECT FROM _timescaledb_catalog.chunk WHERE hypertable_id = ht_id) THEN + RAISE USING + ERRCODE = 'feature_not_supported', + MESSAGE = 'Cannot downgrade compressed hypertables with no compressed chunks. Disable compression on the affected hypertable before downgrading.', + DETAIL = 'The following hypertable is affected: '|| ht_uncomp::text; + END IF; + + chunk_relids := array(SELECT format('%I.%I',schema_name,table_name)::regclass FROM _timescaledb_catalog.chunk WHERE hypertable_id = ht_id); + + -- any hypertable with distinct compression settings cannot be downgraded + IF EXISTS ( + SELECT FROM ( + SELECT DISTINCT segmentby, orderby, orderby_desc, orderby_nullsfirst + FROM _timescaledb_catalog.compression_settings + WHERE relid = hypertable OR relid = ANY(chunk_relids) + ) dist_settings HAVING count(*) > 1 + ) THEN + RAISE USING + ERRCODE = 'feature_not_supported', + MESSAGE = 'Cannot downgrade hypertables with distinct compression settings. Decompress the affected hypertable before downgrading.', + DETAIL = 'The following hypertable is affected: '|| ht_uncomp::text; + END IF; + + END LOOP; +END +$$; + +CREATE FUNCTION _timescaledb_functions.tmp_resolve_indkeys(oid,int2[]) RETURNS text[] LANGUAGE SQL AS $$ + SELECT array_agg(attname) + FROM ( + SELECT attname + FROM (SELECT unnest($2) attnum) indkeys + JOIN LATERAL ( + SELECT attname FROM pg_attribute att WHERE att.attnum=indkeys.attnum AND att.attrelid=$1 + ) r ON true + ) resolve; +$$ SET search_path TO pg_catalog, pg_temp; + +DO $$ +DECLARE + chunk regclass; + hypertable regclass; + ht_id integer; + chunk_id integer; + _index regclass; + ht_index regclass; + chunk_index regclass; + index_name name; + chunk_index_name name; + _indkey text[]; + column_name name; + column_type regtype; + cmd text; +BEGIN + SET timescaledb.restoring TO ON; + + FOR hypertable, ht_id IN + SELECT + format('%I.%I',ht.schema_name,ht.table_name)::regclass, + ht.id + FROM _timescaledb_catalog.hypertable ht_uncomp + INNER JOIN _timescaledb_catalog.hypertable ht + ON ht.id = ht_uncomp.compressed_hypertable_id + LOOP + + -- get first chunk which we use as template for restoring columns and indexes + SELECT format('%I.%I',schema_name,table_name)::regclass INTO STRICT chunk FROM _timescaledb_catalog.chunk WHERE hypertable_id = ht_id ORDER by id LIMIT 1; + + -- restore columns from the compressed hypertable + FOR column_name, column_type IN + SELECT attname, atttypid::regtype FROM pg_attribute WHERE attrelid = chunk AND attnum > 0 + LOOP + cmd := format('ALTER TABLE %s ADD COLUMN %I %s', hypertable, column_name, column_type); + EXECUTE cmd; + END LOOP; + + -- restore indexes on the compressed hypertable + FOR _index, _indkey IN + SELECT indexrelid::regclass, _timescaledb_functions.tmp_resolve_indkeys(indrelid, indkey) FROM pg_index WHERE indrelid = chunk + LOOP + SELECT relname INTO STRICT index_name FROM pg_class WHERE oid = _index; + cmd := pg_get_indexdef(_index); + cmd := replace(cmd, format(' INDEX %s ON ', index_name), ' INDEX ON '); + cmd := replace(cmd, chunk::text, hypertable::text); + EXECUTE cmd; + + -- get indexrelid of index we just created on hypertable + SELECT indexrelid INTO STRICT ht_index FROM pg_index WHERE indrelid = hypertable AND _timescaledb_functions.tmp_resolve_indkeys(hypertable, indkey) = _indkey; + SELECT relname INTO STRICT index_name FROM pg_class WHERE oid = ht_index; + + -- restore indexes in our catalog + FOR chunk, chunk_id IN + SELECT format('%I.%I',schema_name,table_name)::regclass, id FROM _timescaledb_catalog.chunk WHERE hypertable_id = ht_id + LOOP + SELECT indexrelid INTO STRICT chunk_index FROM pg_index WHERE indrelid = chunk AND _timescaledb_functions.tmp_resolve_indkeys(chunk, indkey) = _indkey; + SELECT relname INTO STRICT chunk_index_name FROM pg_class WHERE oid = chunk_index; + INSERT INTO _timescaledb_catalog.chunk_index (chunk_id, index_name, hypertable_id, hypertable_index_name) + VALUES (chunk_id, chunk_index_name, ht_id, index_name); + END LOOP; + + END LOOP; + + -- restore inheritance + cmd := format('ALTER TABLE %s INHERIT %s', chunk, hypertable); + EXECUTE cmd; + + END LOOP; + + SET timescaledb.restoring TO OFF; +END $$; + +DROP FUNCTION _timescaledb_functions.tmp_resolve_indkeys; + CREATE FUNCTION _timescaledb_functions.ping_data_node(node_name NAME, timeout INTERVAL = NULL) RETURNS BOOLEAN AS '@MODULE_PATHNAME@', 'ts_data_node_ping' LANGUAGE C VOLATILE; @@ -625,3 +758,11 @@ ALTER TABLE _timescaledb_catalog.tablespace DROP FUNCTION IF EXISTS _timescaledb_debug.extension_state; DROP SCHEMA IF EXISTS _timescaledb_debug; + +DROP FUNCTION IF EXISTS _timescaledb_internal.hypertable_constraint_add_table_fk_constraint; + +DROP FUNCTION _timescaledb_functions.constraint_clone; + +CREATE FUNCTION _timescaledb_functions.hypertable_constraint_add_table_fk_constraint(user_ht_constraint_name name,user_ht_schema_name name,user_ht_table_name name,compress_ht_id integer) RETURNS void LANGUAGE PLPGSQL AS $$BEGIN END$$ SET search_path TO pg_catalog,pg_temp; + + diff --git a/src/hypertable.c b/src/hypertable.c index 9d15fef0283..2cc2abce551 100644 --- a/src/hypertable.c +++ b/src/hypertable.c @@ -2237,30 +2237,7 @@ ts_hypertable_create_compressed(Oid table_relid, int32 hypertable_id) Oid tspc_oid = get_rel_tablespace(table_relid); NameData schema_name, table_name, associated_schema_name; ChunkSizingInfo *chunk_sizing_info; - Relation rel; - rel = table_open(table_relid, AccessExclusiveLock); - Size row_size = MAXALIGN(SizeofHeapTupleHeader); - /* estimate tuple width of compressed hypertable */ - for (int i = 1; i <= RelationGetNumberOfAttributes(rel); i++) - { - bool is_varlena = false; - Oid outfunc; - Form_pg_attribute att = TupleDescAttr(rel->rd_att, i - 1); - getTypeOutputInfo(att->atttypid, &outfunc, &is_varlena); - if (is_varlena) - row_size += 18; - else - row_size += att->attlen; - } - if (row_size > MaxHeapTupleSize) - { - ereport(WARNING, - (errmsg("compressed row size might exceed maximum row size"), - errdetail("Estimated row size of compressed hypertable is %zu. This exceeds the " - "maximum size of %zu and can cause compression of chunks to fail.", - row_size, - MaxHeapTupleSize))); - } + LockRelationOid(table_relid, AccessExclusiveLock); /* * Check that the user has permissions to make this table to a compressed * hypertable @@ -2271,7 +2248,6 @@ ts_hypertable_create_compressed(Oid table_relid, int32 hypertable_id) ereport(ERROR, (errcode(ERRCODE_TS_HYPERTABLE_EXISTS), errmsg("table \"%s\" is already a hypertable", get_rel_name(table_relid)))); - table_close(rel, AccessExclusiveLock); } namestrcpy(&schema_name, get_namespace_name(get_rel_namespace(table_relid))); @@ -2312,31 +2288,9 @@ ts_hypertable_create_compressed(Oid table_relid, int32 hypertable_id) } insert_blocker_trigger_add(table_relid); - /* lock will be released after the transaction is done */ - table_close(rel, NoLock); return true; } -TSDLLEXPORT void -ts_hypertable_clone_constraints_to_compressed(const Hypertable *user_ht, List *constraint_list) -{ - CatalogSecurityContext sec_ctx; - - ListCell *lc; - Assert(TS_HYPERTABLE_HAS_COMPRESSION_TABLE(user_ht)); - ts_catalog_database_info_become_owner(ts_catalog_database_info_get(), &sec_ctx); - foreach (lc, constraint_list) - { - NameData *conname = lfirst(lc); - CatalogInternalCall4(DDL_ADD_HYPERTABLE_FK_CONSTRAINT, - NameGetDatum(conname), - NameGetDatum(&user_ht->fd.schema_name), - NameGetDatum(&user_ht->fd.table_name), - Int32GetDatum(user_ht->fd.compressed_hypertable_id)); - } - ts_catalog_restore_user(&sec_ctx); -} - /* * Get the max value of an open dimension. */ diff --git a/src/hypertable.h b/src/hypertable.h index f8064990674..7e0ea5cf5ae 100644 --- a/src/hypertable.h +++ b/src/hypertable.h @@ -145,8 +145,6 @@ extern TSDLLEXPORT bool ts_hypertable_set_compressed(Hypertable *ht, extern TSDLLEXPORT bool ts_hypertable_unset_compressed(Hypertable *ht); extern TSDLLEXPORT bool ts_hypertable_set_compress_interval(Hypertable *ht, int64 compress_interval); -extern TSDLLEXPORT void ts_hypertable_clone_constraints_to_compressed(const Hypertable *ht, - List *constraint_list); extern TSDLLEXPORT int64 ts_hypertable_get_open_dim_max_value(const Hypertable *ht, int dimension_index, bool *isnull); diff --git a/src/process_utility.c b/src/process_utility.c index c37ba7d4fff..64ed55c07a7 100644 --- a/src/process_utility.c +++ b/src/process_utility.c @@ -143,6 +143,7 @@ check_chunk_alter_table_operation_allowed(Oid relid, AlterTableStmt *stmt) switch (cmd->subtype) { + case AT_AddConstraint: case AT_SetOptions: case AT_ResetOptions: case AT_SetRelOptions: @@ -1210,6 +1211,22 @@ process_drop_hypertable(ProcessUtilityArgs *args, DropStmt *stmt) { Hypertable *compressed_hypertable = ts_hypertable_get_by_id(ht->fd.compressed_hypertable_id); + List *chunks = ts_chunk_get_by_hypertable_id(ht->fd.compressed_hypertable_id); + foreach (lc, chunks) + { + Chunk *chunk = lfirst(lc); + + if (OidIsValid(chunk->table_id)) + { + ObjectAddress chunk_addr = (ObjectAddress){ + .classId = RelationRelationId, + .objectId = chunk->table_id, + }; + + /* Drop the postgres table */ + performDeletion(&chunk_addr, stmt->behavior, 0); + } + } ts_hypertable_drop(compressed_hypertable, DROP_CASCADE); } } @@ -1480,6 +1497,17 @@ process_grant_and_revoke(ProcessUtilityArgs *args) was_schema_op, &compressed_hypertable->fd.schema_name, &compressed_hypertable->fd.table_name); + List *chunks = + ts_chunk_get_by_hypertable_id(hypertable->fd.compressed_hypertable_id); + ListCell *cell; + foreach (cell, chunks) + { + Chunk *chunk = lfirst(cell); + process_grant_add_by_name(stmt, + was_schema_op, + &chunk->fd.schema_name, + &chunk->fd.table_name); + } } } @@ -2119,6 +2147,13 @@ process_altertable_change_owner(Hypertable *ht, AlterTableCmd *cmd) Hypertable *compressed_hypertable = ts_hypertable_get_by_id(ht->fd.compressed_hypertable_id); AlterTableInternal(compressed_hypertable->main_table_relid, list_make1(cmd), false); + ListCell *lc; + List *chunks = ts_chunk_get_by_hypertable_id(ht->fd.compressed_hypertable_id); + foreach (lc, chunks) + { + Chunk *chunk = lfirst(lc); + AlterTableInternal(chunk->table_id, list_make1(cmd), false); + } process_altertable_change_owner(compressed_hypertable, cmd); } } @@ -3174,6 +3209,14 @@ process_altertable_set_tablespace_end(Hypertable *ht, AlterTableCmd *cmd) Hypertable *compressed_hypertable = ts_hypertable_get_by_id(ht->fd.compressed_hypertable_id); AlterTableInternal(compressed_hypertable->main_table_relid, list_make1(cmd), false); + + List *chunks = ts_chunk_get_by_hypertable_id(ht->fd.compressed_hypertable_id); + ListCell *lc; + foreach (lc, chunks) + { + Chunk *chunk = lfirst(lc); + AlterTableInternal(chunk->table_id, list_make1(cmd), false); + } process_altertable_set_tablespace_end(compressed_hypertable, cmd); } } diff --git a/src/ts_catalog/catalog.c b/src/ts_catalog/catalog.c index d7cce26eec0..37172b57b3e 100644 --- a/src/ts_catalog/catalog.c +++ b/src/ts_catalog/catalog.c @@ -275,9 +275,9 @@ static const InternalFunctionDef internal_function_definitions[_MAX_INTERNAL_FUN .name = "chunk_constraint_add_table_constraint", .args = 1, }, - [DDL_ADD_HYPERTABLE_FK_CONSTRAINT] = { - .name = "hypertable_constraint_add_table_fk_constraint", - .args = 4, + [DDL_CONSTRAINT_CLONE] = { + .name = "constraint_clone", + .args = 2, }, }; diff --git a/src/ts_catalog/catalog.h b/src/ts_catalog/catalog.h index 56c9e2b76e1..65612a9153a 100644 --- a/src/ts_catalog/catalog.h +++ b/src/ts_catalog/catalog.h @@ -86,7 +86,7 @@ typedef struct TableIndexDef typedef enum InternalFunction { DDL_ADD_CHUNK_CONSTRAINT, - DDL_ADD_HYPERTABLE_FK_CONSTRAINT, + DDL_CONSTRAINT_CLONE, _MAX_INTERNAL_FUNCTIONS, } InternalFunction; diff --git a/src/ts_catalog/compression_settings.h b/src/ts_catalog/compression_settings.h index 271eafca19b..6e374891b8b 100644 --- a/src/ts_catalog/compression_settings.h +++ b/src/ts_catalog/compression_settings.h @@ -9,6 +9,7 @@ #include #include "ts_catalog/catalog.h" +#include "hypertable.h" typedef struct CompressionSettings { diff --git a/test/sql/updates/cleanup.policies.sql b/test/sql/updates/cleanup.policies.sql index 42114b7e7e0..385f2764ba0 100644 --- a/test/sql/updates/cleanup.policies.sql +++ b/test/sql/updates/cleanup.policies.sql @@ -2,25 +2,7 @@ -- Please see the included NOTICE for copyright information and -- LICENSE-APACHE for a copy of the license. -DO LANGUAGE PLPGSQL $$ -DECLARE - ts_version TEXT; -BEGIN +PERFORM remove_reorder_policy('policy_test_timestamptz'); +PERFORM remove_retention_policy('policy_test_timestamptz'); +PERFORM remove_compression_policy('policy_test_timestamptz'); - SELECT extversion INTO ts_version FROM pg_extension WHERE extname = 'timescaledb'; - - PERFORM remove_reorder_policy('policy_test_timestamptz'); - - -- some policy API functions got renamed for 2.0 so we need to make - -- sure to use the right name for the version - IF ts_version < '2.0.0' THEN - PERFORM remove_drop_chunks_policy('policy_test_timestamptz'); - PERFORM remove_compress_chunks_policy('policy_test_timestamptz'); - ELSE - PERFORM remove_retention_policy('policy_test_timestamptz'); - PERFORM remove_compression_policy('policy_test_timestamptz'); - END IF; -END -$$; - -DROP TABLE policy_test_timestamptz; diff --git a/test/sql/updates/post.integrity_test.sql b/test/sql/updates/post.integrity_test.sql index 0a5131150f3..9275c1230dd 100644 --- a/test/sql/updates/post.integrity_test.sql +++ b/test/sql/updates/post.integrity_test.sql @@ -18,6 +18,7 @@ DECLARE chunk_count INTEGER; chunk_constraint_count INTEGER; chunk_index_count INTEGER; + chunk_index_count2 INTEGER; BEGIN -- Check integrity of chunk indexes on non-distributed hypertables -- (distributed ones do not have chunk indexes on the access node) @@ -42,8 +43,13 @@ BEGIN AND c.hypertable_index_name = index_row.index_name INTO STRICT chunk_index_count; + SELECT count(c.*) FROM _timescaledb_catalog.chunk_index c + WHERE c.hypertable_id = index_row.hypertable_id +-- AND c.hypertable_index_name = index_row.index_name + INTO STRICT chunk_index_count2; + IF chunk_index_count != chunk_count THEN - RAISE EXCEPTION 'Missing chunk indexes. Expected %, but found %', chunk_count, chunk_index_count; + RAISE EXCEPTION 'Missing chunk index %. Expected %, but found %,%', index_row.index_name, chunk_count, chunk_index_count, chunk_index_count2; END IF; END LOOP; diff --git a/test/sql/updates/pre.cleanup.sql b/test/sql/updates/pre.cleanup.sql index 6cec0cf611a..cbf0d798a9d 100644 --- a/test/sql/updates/pre.cleanup.sql +++ b/test/sql/updates/pre.cleanup.sql @@ -6,11 +6,8 @@ -- should clean them up in each post.*.sql file after generating the -- output, but now we do it here. -SELECT :'TEST_VERSION' >= '2.0.0' AS has_create_mat_view \gset - SET client_min_messages TO WARNING; -\if :has_create_mat_view DROP MATERIALIZED VIEW IF EXISTS mat_inval CASCADE; DROP MATERIALIZED VIEW IF EXISTS mat_drop CASCADE; DROP MATERIALIZED VIEW IF EXISTS mat_before CASCADE; @@ -19,16 +16,6 @@ DROP MATERIALIZED VIEW IF EXISTS mat_inttime CASCADE; DROP MATERIALIZED VIEW IF EXISTS mat_inttime2 CASCADE; DROP MATERIALIZED VIEW IF EXISTS mat_ignoreinval CASCADE; DROP MATERIALIZED VIEW IF EXISTS cagg.realtime_mat CASCADE; -\else -DROP VIEW IF EXISTS mat_inval CASCADE; -DROP VIEW IF EXISTS mat_drop CASCADE; -DROP VIEW IF EXISTS mat_before CASCADE; -DROP VIEW IF EXISTS mat_conflict CASCADE; -DROP VIEW IF EXISTS mat_inttime CASCADE; -DROP VIEW IF EXISTS mat_inttime2 CASCADE; -DROP VIEW IF EXISTS mat_ignoreinval CASCADE; -DROP VIEW IF EXISTS cagg.realtime_mat CASCADE; -\endif DROP TABLE IF EXISTS public.hyper_timestamp; DROP TABLE IF EXISTS public."two_Partitions"; @@ -60,5 +47,5 @@ DROP FUNCTION IF EXISTS integer_now_test; DROP SCHEMA IF EXISTS cagg; DROP SCHEMA IF EXISTS _timescaledb_testing; - RESET client_min_messages; + diff --git a/test/sql/updates/setup.policies.sql b/test/sql/updates/setup.policies.sql index d08902b649d..702163aa5b8 100644 --- a/test/sql/updates/setup.policies.sql +++ b/test/sql/updates/setup.policies.sql @@ -7,14 +7,8 @@ SELECT table_name FROM create_hypertable('policy_test_timestamptz','time'); ALTER TABLE policy_test_timestamptz SET (timescaledb.compress); -SELECT - (string_to_array(extversion,'.'))[1] AS ts_major, - (string_to_array(extversion,'.'))[2] AS ts_minor - FROM pg_extension - WHERE extname = 'timescaledb' \gset - -SELECT - :ts_major < 2 AS has_drop_chunks_policy \gset +INSERT INTO policy_test_timestamptz(time, device_id, value) VALUES ('3020-01-01 00:00:00', 1, 1.0); +SELECT compress_chunk(show_chunks('policy_test_timestamptz')); DO LANGUAGE PLPGSQL $$ DECLARE @@ -36,10 +30,7 @@ BEGIN -- some policy API functions got renamed for 2.0 so we need to make -- sure to use the right name for the version. The schedule_interval -- parameter of add_compression_policy was introduced in 2.8.0 - IF ts_major < 2 THEN - PERFORM add_drop_chunks_policy('policy_test_timestamptz','60d'::interval); - PERFORM add_compress_chunks_policy('policy_test_timestamptz','10d'::interval); - ELSIF ts_major <= 2 AND ts_minor < 8 THEN + IF ts_major = 2 AND ts_minor < 8 THEN PERFORM add_retention_policy('policy_test_timestamptz','60d'::interval); PERFORM add_compression_policy('policy_test_timestamptz','10d'::interval); ELSE @@ -57,19 +48,11 @@ GRANT ALL ON SCHEMA PUBLIC TO "Kim Possible"; SET ROLE "dotted.name"; CREATE TABLE policy_test_user_1(time timestamptz not null, device_id int, value float); SELECT table_name FROM create_hypertable('policy_test_user_1','time'); -\if :has_drop_chunks_policy -SELECT add_drop_chunks_policy('policy_test_user_1', '14 days'::interval); -\else SELECT add_retention_policy('policy_test_user_1', '14 days'::interval); -\endif SET ROLE "Kim Possible"; CREATE TABLE policy_test_user_2(time timestamptz not null, device_id int, value float); SELECT table_name FROM create_hypertable('policy_test_user_2','time'); -\if :has_drop_chunks_policy -SELECT add_drop_chunks_policy('policy_test_user_2', '14 days'::interval); -\else SELECT add_retention_policy('policy_test_user_2', '14 days'::interval); -\endif RESET ROLE; \endif diff --git a/tsl/src/compression/CMakeLists.txt b/tsl/src/compression/CMakeLists.txt index 647b7884ae8..cca347bccdf 100644 --- a/tsl/src/compression/CMakeLists.txt +++ b/tsl/src/compression/CMakeLists.txt @@ -2,6 +2,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/api.c ${CMAKE_CURRENT_SOURCE_DIR}/array.c ${CMAKE_CURRENT_SOURCE_DIR}/compression.c + ${CMAKE_CURRENT_SOURCE_DIR}/compression_storage.c ${CMAKE_CURRENT_SOURCE_DIR}/compression_test.c ${CMAKE_CURRENT_SOURCE_DIR}/decompress_text_test_impl.c ${CMAKE_CURRENT_SOURCE_DIR}/create.c diff --git a/tsl/src/compression/compression_storage.c b/tsl/src/compression/compression_storage.c new file mode 100644 index 00000000000..31ba583b4cb --- /dev/null +++ b/tsl/src/compression/compression_storage.c @@ -0,0 +1,389 @@ +/* + * 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. + */ + +/* + * This file contains functions for manipulating compression related + * internal storage objects like creating the underlying tables and + * setting storage options. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "extension_constants.h" +#include "custom_type_cache.h" +#include "ts_catalog/catalog.h" +#include "ts_catalog/compression_settings.h" +#include "compression_storage.h" +#include "hypertable.h" +#include "compression.h" +#include "create.h" +#include "utils.h" + +#define PRINT_COMPRESSION_TABLE_NAME(buf, prefix, hypertable_id) \ + do \ + { \ + int ret = snprintf(buf, NAMEDATALEN, prefix, hypertable_id); \ + if (ret < 0 || ret > NAMEDATALEN) \ + { \ + ereport(ERROR, \ + (errcode(ERRCODE_INTERNAL_ERROR), \ + errmsg("bad compression hypertable internal name"))); \ + } \ + } while (0); + +static void set_toast_tuple_target_on_chunk(Oid compressed_table_id); +static void set_statistics_on_compressed_chunk(Oid compressed_table_id); +static void create_compressed_chunk_indexes(Chunk *chunk, CompressionSettings *settings); +static void clone_constraints_to_chunk(Oid ht_reloid, const Chunk *compressed_chunk); +static List *get_fk_constraints(Oid reloid); + +int32 +compression_hypertable_create(Hypertable *ht, Oid owner, Oid tablespace_oid) +{ + ObjectAddress tbladdress; + char relnamebuf[NAMEDATALEN]; + CatalogSecurityContext sec_ctx; + Oid compress_relid; + + CreateStmt *create; + RangeVar *compress_rel; + int32 compress_hypertable_id; + + create = makeNode(CreateStmt); + create->tableElts = NIL; + create->inhRelations = NIL; + create->ofTypename = NULL; + create->constraints = NIL; + create->options = NULL; + create->oncommit = ONCOMMIT_NOOP; + create->tablespacename = get_tablespace_name(tablespace_oid); + create->if_not_exists = false; + + /* Invalid tablespace_oid <=> NULL tablespace name */ + Assert(!OidIsValid(tablespace_oid) == (create->tablespacename == NULL)); + + /* create the compression table */ + /* NewRelationCreateToastTable calls CommandCounterIncrement */ + ts_catalog_database_info_become_owner(ts_catalog_database_info_get(), &sec_ctx); + compress_hypertable_id = ts_catalog_table_next_seq_id(ts_catalog_get(), HYPERTABLE); + PRINT_COMPRESSION_TABLE_NAME(relnamebuf, "_compressed_hypertable_%d", compress_hypertable_id); + compress_rel = makeRangeVar(pstrdup(INTERNAL_SCHEMA_NAME), pstrdup(relnamebuf), -1); + + create->relation = compress_rel; + tbladdress = DefineRelation(create, RELKIND_RELATION, owner, NULL, NULL); + CommandCounterIncrement(); + compress_relid = tbladdress.objectId; + ts_copy_relation_acl(ht->main_table_relid, compress_relid, owner); + ts_catalog_restore_user(&sec_ctx); + ts_hypertable_create_compressed(compress_relid, compress_hypertable_id); + + return compress_hypertable_id; +} + +Oid +compression_chunk_create(Chunk *src_chunk, Chunk *chunk, List *column_defs, Oid tablespace_oid) +{ + ObjectAddress tbladdress; + CatalogSecurityContext sec_ctx; + Datum toast_options; + static char *validnsps[] = HEAP_RELOPT_NAMESPACES; + CompressionSettings *settings = ts_compression_settings_get(src_chunk->hypertable_relid); + + Oid owner = ts_rel_get_owner(chunk->hypertable_relid); + + CreateStmt *create; + RangeVar *compress_rel; + + create = makeNode(CreateStmt); + create->tableElts = column_defs; + create->inhRelations = NIL; + create->ofTypename = NULL; + create->constraints = NIL; + create->options = NULL; + create->oncommit = ONCOMMIT_NOOP; + create->tablespacename = get_tablespace_name(tablespace_oid); + create->if_not_exists = false; + + /* Invalid tablespace_oid <=> NULL tablespace name */ + Assert(!OidIsValid(tablespace_oid) == (create->tablespacename == NULL)); + + /* create the compression table */ + /* NewRelationCreateToastTable calls CommandCounterIncrement */ + ts_catalog_database_info_become_owner(ts_catalog_database_info_get(), &sec_ctx); + compress_rel = makeRangeVar(NameStr(chunk->fd.schema_name), NameStr(chunk->fd.table_name), -1); + + create->relation = compress_rel; + tbladdress = DefineRelation(create, RELKIND_RELATION, owner, NULL, NULL); + CommandCounterIncrement(); + chunk->table_id = tbladdress.objectId; + ts_copy_relation_acl(chunk->hypertable_relid, chunk->table_id, owner); + toast_options = + transformRelOptions((Datum) 0, create->options, "toast", validnsps, true, false); + (void) heap_reloptions(RELKIND_TOASTVALUE, toast_options, true); + NewRelationCreateToastTable(chunk->table_id, toast_options); + ts_catalog_restore_user(&sec_ctx); + modify_compressed_toast_table_storage(settings, column_defs, chunk->table_id); + + set_statistics_on_compressed_chunk(chunk->table_id); + set_toast_tuple_target_on_chunk(chunk->table_id); + + create_compressed_chunk_indexes(chunk, settings); + + clone_constraints_to_chunk(src_chunk->hypertable_relid, chunk); + + return chunk->table_id; +} + +static void +set_toast_tuple_target_on_chunk(Oid compressed_table_id) +{ + DefElem def_elem = { + .type = T_DefElem, + .defname = "toast_tuple_target", + .arg = (Node *) makeInteger(128), + .defaction = DEFELEM_SET, + .location = -1, + }; + AlterTableCmd cmd = { + .type = T_AlterTableCmd, + .subtype = AT_SetRelOptions, + .def = (Node *) list_make1(&def_elem), + }; + ts_alter_table_with_event_trigger(compressed_table_id, NULL, list_make1(&cmd), true); +} + +static void +set_statistics_on_compressed_chunk(Oid compressed_table_id) +{ + Relation table_rel = table_open(compressed_table_id, ShareUpdateExclusiveLock); + Relation attrelation = table_open(AttributeRelationId, RowExclusiveLock); + TupleDesc table_desc = RelationGetDescr(table_rel); + Oid compressed_data_type = ts_custom_type_cache_get(CUSTOM_TYPE_COMPRESSED_DATA)->type_oid; + for (int i = 0; i < table_desc->natts; i++) + { + Form_pg_attribute attrtuple; + HeapTuple tuple; + Form_pg_attribute col_attr = TupleDescAttr(table_desc, i); + + /* skip system columns */ + if (col_attr->attnum <= 0) + continue; + + tuple = SearchSysCacheCopyAttName(compressed_table_id, NameStr(col_attr->attname)); + + if (!HeapTupleIsValid(tuple)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_COLUMN), + errmsg("column \"%s\" of compressed table \"%s\" does not exist", + NameStr(col_attr->attname), + RelationGetRelationName(table_rel)))); + + attrtuple = (Form_pg_attribute) GETSTRUCT(tuple); + + /* the planner should never look at compressed column statistics because + * it will not understand them. Statistics on the other columns, + * segmentbys and metadata, are very important, so we increase their + * target. + */ + if (col_attr->atttypid == compressed_data_type) + attrtuple->attstattarget = 0; + else + attrtuple->attstattarget = 1000; + + CatalogTupleUpdate(attrelation, &tuple->t_self, tuple); + + InvokeObjectPostAlterHook(RelationRelationId, compressed_table_id, attrtuple->attnum); + heap_freetuple(tuple); + } + + table_close(attrelation, NoLock); + table_close(table_rel, NoLock); +} + +/* modify storage attributes for toast table columns attached to the + * compression table + */ +void +modify_compressed_toast_table_storage(CompressionSettings *settings, List *coldefs, + Oid compress_relid) +{ + ListCell *lc; + List *cmds = NIL; + Oid compresseddata_oid = ts_custom_type_cache_get(CUSTOM_TYPE_COMPRESSED_DATA)->type_oid; + + foreach (lc, coldefs) + { + ColumnDef *cd = lfirst_node(ColumnDef, lc); + AttrNumber attno = get_attnum(compress_relid, cd->colname); + if (attno != InvalidAttrNumber && get_atttype(compress_relid, attno) == compresseddata_oid) + { + /* + * All columns that pass the datatype check are columns + * that are also present in the uncompressed hypertable. + * Metadata columns are missing from the uncompressed + * hypertable but they do not have compresseddata datatype + * and therefore would be skipped. + */ + attno = get_attnum(settings->fd.relid, cd->colname); + Assert(attno != InvalidAttrNumber); + Oid typid = get_atttype(settings->fd.relid, attno); + CompressionStorage stor = + compression_get_toast_storage(compression_get_default_algorithm(typid)); + if (stor != TOAST_STORAGE_EXTERNAL) + /* external is default storage for toast columns */ + { + AlterTableCmd *cmd = makeNode(AlterTableCmd); + cmd->subtype = AT_SetStorage; + cmd->name = pstrdup(cd->colname); + Assert(stor == TOAST_STORAGE_EXTENDED); + cmd->def = (Node *) makeString("extended"); + cmds = lappend(cmds, cmd); + } + } + } + + if (cmds != NIL) + { + ts_alter_table_with_event_trigger(compress_relid, NULL, cmds, false); + } +} + +static void +create_compressed_chunk_indexes(Chunk *chunk, CompressionSettings *settings) +{ + IndexStmt stmt = { + .type = T_IndexStmt, + .accessMethod = DEFAULT_INDEX_TYPE, + .idxname = NULL, + .relation = makeRangeVar(NameStr(chunk->fd.schema_name), NameStr(chunk->fd.table_name), 0), + .tableSpace = get_tablespace_name(get_rel_tablespace(chunk->table_id)), + }; + IndexElem sequence_num_elem = { + .type = T_IndexElem, + .name = COMPRESSION_COLUMN_METADATA_SEQUENCE_NUM_NAME, + }; + NameData index_name; + ObjectAddress index_addr; + HeapTuple index_tuple; + List *indexcols = NIL; + + StringInfo buf = makeStringInfo(); + + if (settings->fd.segmentby) + { + Datum datum; + bool isnull; + ArrayIterator it = array_create_iterator(settings->fd.segmentby, 0, NULL); + while (array_iterate(it, &datum, &isnull)) + { + IndexElem *segment_elem = makeNode(IndexElem); + segment_elem->name = TextDatumGetCString(datum); + appendStringInfoString(buf, segment_elem->name); + appendStringInfoString(buf, ", "); + indexcols = lappend(indexcols, segment_elem); + } + } + + if (list_length(indexcols) == 0) + { + return; + } + + appendStringInfoString(buf, COMPRESSION_COLUMN_METADATA_SEQUENCE_NUM_NAME); + indexcols = lappend(indexcols, &sequence_num_elem); + + stmt.indexParams = indexcols; + index_addr = DefineIndexCompat(chunk->table_id, + &stmt, + InvalidOid, /* IndexRelationId */ + InvalidOid, /* parentIndexId */ + InvalidOid, /* parentConstraintId */ + -1, /* total_parts */ + false, /* is_alter_table */ + false, /* check_rights */ + false, /* check_not_in_use */ + false, /* skip_build */ + false); /* quiet */ + index_tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(index_addr.objectId)); + + if (!HeapTupleIsValid(index_tuple)) + elog(ERROR, "cache lookup failed for index relid %u", index_addr.objectId); + index_name = ((Form_pg_class) GETSTRUCT(index_tuple))->relname; + + elog(DEBUG1, + "adding index %s ON %s.%s USING BTREE(%s)", + NameStr(index_name), + NameStr(chunk->fd.schema_name), + NameStr(chunk->fd.table_name), + buf->data); + + ReleaseSysCache(index_tuple); +} + +static void +clone_constraints_to_chunk(Oid ht_reloid, const Chunk *compressed_chunk) +{ + CatalogSecurityContext sec_ctx; + List *constraint_list = get_fk_constraints(ht_reloid); + + ListCell *lc; + ts_catalog_database_info_become_owner(ts_catalog_database_info_get(), &sec_ctx); + foreach (lc, constraint_list) + { + Oid conoid = lfirst_oid(lc); + CatalogInternalCall2(DDL_CONSTRAINT_CLONE, + Int32GetDatum(conoid), + Int32GetDatum(compressed_chunk->table_id)); + } + ts_catalog_restore_user(&sec_ctx); +} + +static List * +get_fk_constraints(Oid reloid) +{ + SysScanDesc scan; + ScanKeyData scankey; + HeapTuple tuple; + List *conlist = NIL; + + Relation pg_constr = table_open(ConstraintRelationId, AccessShareLock); + + ScanKeyInit(&scankey, + Anum_pg_constraint_conrelid, + BTEqualStrategyNumber, + F_OIDEQ, + ObjectIdGetDatum(reloid)); + + scan = systable_beginscan(pg_constr, ConstraintRelidTypidNameIndexId, true, NULL, 1, &scankey); + while (HeapTupleIsValid(tuple = systable_getnext(scan))) + { + Form_pg_constraint form = (Form_pg_constraint) GETSTRUCT(tuple); + + if (form->contype == CONSTRAINT_FOREIGN) + { + conlist = lappend_oid(conlist, form->oid); + } + } + + systable_endscan(scan); + table_close(pg_constr, AccessShareLock); + + return conlist; +} diff --git a/tsl/src/compression/compression_storage.h b/tsl/src/compression/compression_storage.h new file mode 100644 index 00000000000..832bb96eefe --- /dev/null +++ b/tsl/src/compression/compression_storage.h @@ -0,0 +1,21 @@ +/* + * 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. + */ + +/* + * This file contains functions for manipulating compression related + * internal storage objects like creating the underlying tables and + * setting storage options. + */ + +#include + +#include "chunk.h" +#include "hypertable.h" + +int32 compression_hypertable_create(Hypertable *ht, Oid owner, Oid tablespace_oid); +Oid compression_chunk_create(Chunk *src_chunk, Chunk *chunk, List *column_defs, Oid tablespace_oid); +void modify_compressed_toast_table_storage(CompressionSettings *settings, List *coldefs, + Oid compress_relid); diff --git a/tsl/src/compression/create.c b/tsl/src/compression/create.c index 3b974b2490e..b73143b509e 100644 --- a/tsl/src/compression/create.c +++ b/tsl/src/compression/create.c @@ -40,27 +40,17 @@ #include "ts_catalog/continuous_agg.h" #include "compression_with_clause.h" #include "compression.h" +#include "compression/compression_storage.h" #include "hypertable_cache.h" #include "custom_type_cache.h" #include "trigger.h" #include "utils.h" #include "guc.h" +static void validate_hypertable_for_compression(Hypertable *ht); static List *build_columndefs(CompressionSettings *settings, Oid src_relid); static ColumnDef *build_columndef_singlecolumn(const char *colname, Oid typid); -#define PRINT_COMPRESSION_TABLE_NAME(buf, prefix, hypertable_id) \ - do \ - { \ - int ret = snprintf(buf, NAMEDATALEN, prefix, hypertable_id); \ - if (ret < 0 || ret > NAMEDATALEN) \ - { \ - ereport(ERROR, \ - (errcode(ERRCODE_INTERNAL_ERROR), \ - errmsg("bad compression hypertable internal name"))); \ - } \ - } while (0); - static char * compression_column_segment_metadata_name(int16 column_index, const char *type) { @@ -142,6 +132,15 @@ check_orderby(Oid relid, List *orderby_cols, ArrayType *segmentby) errhint("The timescaledb.compress_orderby option must reference a valid " "column."))); + Oid col_type = get_atttype(relid, col_attno); + TypeCacheEntry *type = lookup_type_cache(col_type, TYPECACHE_LT_OPR); + + if (!OidIsValid(type->lt_opr)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_FUNCTION), + errmsg("invalid ordering column type %s", format_type_be(col_type)), + errdetail("Could not identify a less-than operator for the type."))); + const char *col_attname = get_attname(relid, col_attno, false); /* check if orderby columns are distinct. */ @@ -277,253 +276,14 @@ build_columndef_singlecolumn(const char *colname, Oid typid) { Oid compresseddata_oid = ts_custom_type_cache_get(CUSTOM_TYPE_COMPRESSED_DATA)->type_oid; - return makeColumnDef(colname, compresseddata_oid, -1 /*typmod*/, 0 /*collation*/); -} - -/* modify storage attributes for toast table columns attached to the - * compression table - */ -static void -modify_compressed_toast_table_storage(CompressionSettings *settings, List *coldefs, - Oid compress_relid) -{ - ListCell *lc; - List *cmds = NIL; - Oid compresseddata_oid = ts_custom_type_cache_get(CUSTOM_TYPE_COMPRESSED_DATA)->type_oid; - - foreach (lc, coldefs) - { - ColumnDef *cd = lfirst_node(ColumnDef, lc); - AttrNumber attno = get_attnum(compress_relid, cd->colname); - if (attno != InvalidAttrNumber && get_atttype(compress_relid, attno) == compresseddata_oid) - { - /* - * All columns that pass the datatype check are columns - * that are also present in the uncompressed hypertable. - * Metadata columns are missing from the uncompressed - * hypertable but they do not have compresseddata datatype - * and therefore would be skipped. - */ - attno = get_attnum(settings->fd.relid, cd->colname); - Assert(attno != InvalidAttrNumber); - Oid typid = get_atttype(settings->fd.relid, attno); - CompressionStorage stor = - compression_get_toast_storage(compression_get_default_algorithm(typid)); - if (stor != TOAST_STORAGE_EXTERNAL) - /* external is default storage for toast columns */ - { - AlterTableCmd *cmd = makeNode(AlterTableCmd); - cmd->subtype = AT_SetStorage; - cmd->name = pstrdup(cd->colname); - Assert(stor == TOAST_STORAGE_EXTENDED); - cmd->def = (Node *) makeString("extended"); - cmds = lappend(cmds, cmd); - } - } - } - - if (cmds != NIL) - { - ts_alter_table_with_event_trigger(compress_relid, NULL, cmds, false); - } -} - -static void -create_compressed_table_indexes(Oid compresstable_relid, CompressionSettings *settings) -{ - Cache *hcache; - Hypertable *ht = - ts_hypertable_cache_get_cache_and_entry(compresstable_relid, CACHE_FLAG_NONE, &hcache); - IndexStmt stmt = { - .type = T_IndexStmt, - .accessMethod = DEFAULT_INDEX_TYPE, - .idxname = NULL, - .relation = makeRangeVar(NameStr(ht->fd.schema_name), NameStr(ht->fd.table_name), 0), - .tableSpace = get_tablespace_name(get_rel_tablespace(ht->main_table_relid)), - }; - IndexElem sequence_num_elem = { - .type = T_IndexElem, - .name = COMPRESSION_COLUMN_METADATA_SEQUENCE_NUM_NAME, - }; - NameData index_name; - ObjectAddress index_addr; - HeapTuple index_tuple; - List *indexcols = NIL; - - StringInfo buf = makeStringInfo(); - - if (settings->fd.segmentby) - { - Datum datum; - bool isnull; - ArrayIterator it = array_create_iterator(settings->fd.segmentby, 0, NULL); - while (array_iterate(it, &datum, &isnull)) - { - IndexElem *segment_elem = makeNode(IndexElem); - segment_elem->name = TextDatumGetCString(datum); - appendStringInfoString(buf, segment_elem->name); - appendStringInfoString(buf, ", "); - indexcols = lappend(indexcols, segment_elem); - } - } - - if (list_length(indexcols) == 0) - { - ts_cache_release(hcache); - return; - } - - appendStringInfoString(buf, COMPRESSION_COLUMN_METADATA_SEQUENCE_NUM_NAME); - indexcols = lappend(indexcols, &sequence_num_elem); - - stmt.indexParams = indexcols; - index_addr = DefineIndexCompat(ht->main_table_relid, - &stmt, - InvalidOid, /* IndexRelationId */ - InvalidOid, /* parentIndexId */ - InvalidOid, /* parentConstraintId */ - -1, /* total_parts */ - false, /* is_alter_table */ - false, /* check_rights */ - false, /* check_not_in_use */ - false, /* skip_build */ - false); /* quiet */ - index_tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(index_addr.objectId)); - - if (!HeapTupleIsValid(index_tuple)) - elog(ERROR, "cache lookup failed for index relid %u", index_addr.objectId); - index_name = ((Form_pg_class) GETSTRUCT(index_tuple))->relname; - - elog(DEBUG1, - "adding index %s ON %s.%s USING BTREE(%s)", - NameStr(index_name), - NameStr(ht->fd.schema_name), - NameStr(ht->fd.table_name), - buf->data); - - ReleaseSysCache(index_tuple); - - ts_cache_release(hcache); -} - -static void -set_statistics_on_compressed_table(Oid compressed_table_id) -{ - Relation table_rel = table_open(compressed_table_id, ShareUpdateExclusiveLock); - Relation attrelation = table_open(AttributeRelationId, RowExclusiveLock); - TupleDesc table_desc = RelationGetDescr(table_rel); - Oid compressed_data_type = ts_custom_type_cache_get(CUSTOM_TYPE_COMPRESSED_DATA)->type_oid; - for (int i = 0; i < table_desc->natts; i++) - { - Form_pg_attribute attrtuple; - HeapTuple tuple; - Form_pg_attribute col_attr = TupleDescAttr(table_desc, i); - - /* skip system columns */ - if (col_attr->attnum <= 0) - continue; - - tuple = SearchSysCacheCopyAttName(compressed_table_id, NameStr(col_attr->attname)); - - if (!HeapTupleIsValid(tuple)) - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of compressed table \"%s\" does not exist", - NameStr(col_attr->attname), - RelationGetRelationName(table_rel)))); - - attrtuple = (Form_pg_attribute) GETSTRUCT(tuple); - - /* the planner should never look at compressed column statistics because - * it will not understand them. Statistics on the other columns, - * segmentbys and metadata, are very important, so we increase their - * target. - */ - if (col_attr->atttypid == compressed_data_type) - attrtuple->attstattarget = 0; - else - attrtuple->attstattarget = 1000; - - CatalogTupleUpdate(attrelation, &tuple->t_self, tuple); - - InvokeObjectPostAlterHook(RelationRelationId, compressed_table_id, attrtuple->attnum); - heap_freetuple(tuple); - } - - table_close(attrelation, NoLock); - table_close(table_rel, NoLock); -} - -static void -set_toast_tuple_target_on_compressed(Oid compressed_table_id) -{ - DefElem def_elem = { - .type = T_DefElem, - .defname = "toast_tuple_target", - .arg = (Node *) makeInteger(128), - .defaction = DEFELEM_SET, - .location = -1, - }; - AlterTableCmd cmd = { - .type = T_AlterTableCmd, - .subtype = AT_SetRelOptions, - .def = (Node *) list_make1(&def_elem), - }; - ts_alter_table_with_event_trigger(compressed_table_id, NULL, list_make1(&cmd), true); -} - -static int32 -create_compression_table(Oid owner, CompressionSettings *settings, List *coldefs, - Oid tablespace_oid) -{ - ObjectAddress tbladdress; - char relnamebuf[NAMEDATALEN]; - CatalogSecurityContext sec_ctx; - Datum toast_options; - static char *validnsps[] = HEAP_RELOPT_NAMESPACES; - Oid compress_relid; - - CreateStmt *create; - RangeVar *compress_rel; - int32 compress_hypertable_id; - - create = makeNode(CreateStmt); - create->tableElts = coldefs; - create->inhRelations = NIL; - create->ofTypename = NULL; - create->constraints = NIL; - create->options = NULL; - create->oncommit = ONCOMMIT_NOOP; - create->tablespacename = get_tablespace_name(tablespace_oid); - create->if_not_exists = false; - - /* Invalid tablespace_oid <=> NULL tablespace name */ - Assert(!OidIsValid(tablespace_oid) == (create->tablespacename == NULL)); - - /* create the compression table */ - /* NewRelationCreateToastTable calls CommandCounterIncrement */ - ts_catalog_database_info_become_owner(ts_catalog_database_info_get(), &sec_ctx); - compress_hypertable_id = ts_catalog_table_next_seq_id(ts_catalog_get(), HYPERTABLE); - PRINT_COMPRESSION_TABLE_NAME(relnamebuf, "_compressed_hypertable_%d", compress_hypertable_id); - compress_rel = makeRangeVar(pstrdup(INTERNAL_SCHEMA_NAME), pstrdup(relnamebuf), -1); - - create->relation = compress_rel; - tbladdress = DefineRelation(create, RELKIND_RELATION, owner, NULL, NULL); - CommandCounterIncrement(); - compress_relid = tbladdress.objectId; - toast_options = - transformRelOptions((Datum) 0, create->options, "toast", validnsps, true, false); - (void) heap_reloptions(RELKIND_TOASTVALUE, toast_options, true); - NewRelationCreateToastTable(compress_relid, toast_options); - ts_catalog_restore_user(&sec_ctx); - modify_compressed_toast_table_storage(settings, coldefs, compress_relid); - ts_hypertable_create_compressed(compress_relid, compress_hypertable_id); + if (strncmp(colname, + COMPRESSION_COLUMN_METADATA_PREFIX, + strlen(COMPRESSION_COLUMN_METADATA_PREFIX)) == 0) + elog(ERROR, + "cannot compress tables with reserved column prefix '%s'", + COMPRESSION_COLUMN_METADATA_PREFIX); - set_statistics_on_compressed_table(compress_relid); - set_toast_tuple_target_on_compressed(compress_relid); - - create_compressed_table_indexes(compress_relid, settings); - return compress_hypertable_id; + return makeColumnDef(colname, compresseddata_oid, -1 /*typmod*/, 0 /*collation*/); } /* @@ -542,7 +302,6 @@ create_compress_chunk(Hypertable *compress_ht, Chunk *src_chunk, Oid table_id) Chunk *compress_chunk; int namelen; Oid tablespace_oid; - const char *tablespace; Assert(compress_ht->space->num_dimensions == 0); @@ -600,12 +359,16 @@ create_compress_chunk(Hypertable *compress_ht, Chunk *src_chunk, Oid table_id) * for now. */ tablespace_oid = get_rel_tablespace(src_chunk->table_id); - tablespace = get_tablespace_name(tablespace_oid); if (OidIsValid(table_id)) compress_chunk->table_id = table_id; else - compress_chunk->table_id = ts_chunk_create_table(compress_chunk, compress_ht, tablespace); + { + CompressionSettings *settings = ts_compression_settings_get(src_chunk->hypertable_relid); + List *column_defs = build_columndefs(settings, src_chunk->table_id); + compress_chunk->table_id = + compression_chunk_create(src_chunk, compress_chunk, column_defs, tablespace_oid); + } if (!OidIsValid(compress_chunk->table_id)) elog(ERROR, "could not create compressed chunk table"); @@ -673,13 +436,14 @@ add_time_to_order_by_if_not_included(List *orderby_cols, List *segmentby_cols, H * This is limited to foreign key constraints now */ static List * -validate_existing_constraints(Hypertable *ht, CompressionSettings *settings, List **indexes) +validate_existing_constraints(Hypertable *ht, CompressionSettings *settings) { Relation pg_constr; SysScanDesc scan; ScanKeyData scankey; HeapTuple tuple; List *conlist = NIL; + ArrayType *arr; pg_constr = table_open(ConstraintRelationId, AccessShareLock); @@ -695,15 +459,6 @@ validate_existing_constraints(Hypertable *ht, CompressionSettings *settings, Lis { Form_pg_constraint form = (Form_pg_constraint) GETSTRUCT(tuple); - /* Save away the supporting index, if any, that we check so that we - * can ignore it in the index checking and not get duplicate messages. - * - * We are saving all checked indexes here even though only the unique - * index is a problem at this point. It potentially avoids a second - * check of an index that we have already checked. */ - if (OidIsValid(form->conindid)) - *indexes = lappend_oid(*indexes, form->conindid); - /* * We check primary, unique, and exclusion constraints. Move foreign * key constraints over to compression table ignore triggers @@ -761,7 +516,7 @@ validate_existing_constraints(Hypertable *ht, CompressionSettings *settings, Lis NameStr(form->conname)))); } /* is colno a segment-by or order_by column */ - else if (!ts_array_is_member(settings->fd.segmentby, attname) && + else if (!form->conindid && !ts_array_is_member(settings->fd.segmentby, attname) && !ts_array_is_member(settings->fd.orderby, attname)) ereport(WARNING, (errmsg("column \"%s\" should be used for segmenting or ordering", @@ -779,6 +534,7 @@ validate_existing_constraints(Hypertable *ht, CompressionSettings *settings, Lis systable_endscan(scan); table_close(pg_constr, AccessShareLock); + return conlist; } @@ -790,7 +546,7 @@ validate_existing_constraints(Hypertable *ht, CompressionSettings *settings, Lis * by the constraint checking above. */ static void -validate_existing_indexes(Hypertable *ht, CompressionSettings *settings, List *ignore) +validate_existing_indexes(Hypertable *ht, CompressionSettings *settings) { Relation pg_index; HeapTuple htup; @@ -814,9 +570,7 @@ validate_existing_indexes(Hypertable *ht, CompressionSettings *settings, List *i * exclusion indexes, and any indexes checked by the constraint * checking. We can also skip checks below if the index is not a * unique index. */ - if (!index->indislive || !index->indisvalid || index->indisexclusion || - index->indisprimary || !index->indisunique || - list_member_oid(ignore, index->indexrelid)) + if (!index->indislive || !index->indisvalid || index->indisexclusion || !index->indisunique) continue; /* Now we check that all columns of the unique index are part of the @@ -953,40 +707,36 @@ disable_compression(Hypertable *ht, WithClauseResult *with_clause_options) /* Add column to internal compression table */ static void -add_column_to_compression_table(Hypertable *compress_ht, CompressionSettings *settings, - ColumnDef *coldef) +add_column_to_compression_table(Oid relid, CompressionSettings *settings, ColumnDef *coldef) { - Oid compress_relid = compress_ht->main_table_relid; AlterTableCmd *addcol_cmd; /* create altertable stmt to add column to the compressed hypertable */ - Assert(TS_HYPERTABLE_IS_INTERNAL_COMPRESSION_TABLE(compress_ht)); + // Assert(TS_HYPERTABLE_IS_INTERNAL_COMPRESSION_TABLE(compress_ht)); addcol_cmd = makeNode(AlterTableCmd); addcol_cmd->subtype = AT_AddColumn; addcol_cmd->def = (Node *) coldef; addcol_cmd->missing_ok = false; /* alter the table and add column */ - ts_alter_table_with_event_trigger(compress_relid, NULL, list_make1(addcol_cmd), true); - modify_compressed_toast_table_storage(settings, list_make1(coldef), compress_relid); + ts_alter_table_with_event_trigger(relid, NULL, list_make1(addcol_cmd), true); + modify_compressed_toast_table_storage(settings, list_make1(coldef), relid); } /* Drop column from internal compression table */ static void -drop_column_from_compression_table(Hypertable *compress_ht, char *name) +drop_column_from_compression_table(Oid relid, char *name) { - Oid compress_relid = compress_ht->main_table_relid; AlterTableCmd *cmd; /* create altertable stmt to drop column from the compressed hypertable */ - Assert(TS_HYPERTABLE_IS_INTERNAL_COMPRESSION_TABLE(compress_ht)); cmd = makeNode(AlterTableCmd); cmd->subtype = AT_DropColumn; cmd->name = name; cmd->missing_ok = true; /* alter the table and drop column */ - ts_alter_table_with_event_trigger(compress_relid, NULL, list_make1(cmd), true); + ts_alter_table_with_event_trigger(relid, NULL, list_make1(cmd), true); } static bool @@ -1034,22 +784,11 @@ tsl_process_compress_table(AlterTableCmd *cmd, Hypertable *ht, Oid ownerid; List *segmentby_cols; List *orderby_cols; - List *constraint_list = NIL; CompressionSettings *settings; ts_feature_flag_check(FEATURE_HYPERTABLE_COMPRESSION); - if (TS_HYPERTABLE_IS_INTERNAL_COMPRESSION_TABLE(ht)) - { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot compress internal compression hypertable"))); - } - /*check row security settings for the table */ - if (ts_has_row_security(ht->main_table_relid)) - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("compression cannot be used on table with row security"))); + validate_hypertable_for_compression(ht); /* Lock the uncompressed ht in exclusive mode and keep till end of txn */ LockRelationOid(ht->main_table_relid, AccessExclusiveLock); @@ -1085,8 +824,6 @@ tsl_process_compress_table(AlterTableCmd *cmd, Hypertable *ht, check_segmentby(ht->main_table_relid, segmentby_cols); check_orderby(ht->main_table_relid, orderby_cols, settings->fd.segmentby); - List *column_defs = build_columndefs(settings, ht->main_table_relid); - /* take explicit locks on catalog tables and keep them till end of txn */ LockRelationOid(catalog_get_table_id(ts_catalog_get(), HYPERTABLE), RowExclusiveLock); @@ -1098,13 +835,11 @@ tsl_process_compress_table(AlterTableCmd *cmd, Hypertable *ht, /* Check if we can create a compressed hypertable with existing * constraints and indexes. */ - List *indexes = NIL; - constraint_list = validate_existing_constraints(ht, settings, &indexes); - validate_existing_indexes(ht, settings, indexes); - list_free(indexes); + validate_existing_constraints(ht, settings); + validate_existing_indexes(ht, settings); Oid tablespace_oid = get_rel_tablespace(ht->main_table_relid); - compress_htid = create_compression_table(ownerid, settings, column_defs, tablespace_oid); + compress_htid = compression_hypertable_create(ht, ownerid, tablespace_oid); ts_hypertable_set_compressed(ht, compress_htid); if (!with_clause_options[CompressChunkTimeInterval].is_default) @@ -1112,14 +847,70 @@ tsl_process_compress_table(AlterTableCmd *cmd, Hypertable *ht, update_compress_chunk_time_interval(ht, with_clause_options); } - /*add the constraints to the new compressed hypertable */ - ht = ts_hypertable_get_by_id(ht->fd.id); /*reload updated info*/ - ts_hypertable_clone_constraints_to_compressed(ht, constraint_list); - /* do not release any locks, will get released by xact end */ return true; } +/* + * Verify uncompressed hypertable is compatible with conpression + */ +static void +validate_hypertable_for_compression(Hypertable *ht) +{ + if (TS_HYPERTABLE_IS_INTERNAL_COMPRESSION_TABLE(ht)) + { + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot compress internal compression hypertable"))); + } + + /*check row security settings for the table */ + if (ts_has_row_security(ht->main_table_relid)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("compression cannot be used on table with row security"))); + + Relation rel = table_open(ht->main_table_relid, AccessShareLock); + TupleDesc tupdesc = RelationGetDescr(rel); + + /* + * This is only a rough estimate and the actual row size might be different. + * We use this only to show a warning when the row size is close to the + * maximum row size. + */ + Size row_size = MAXALIGN(SizeofHeapTupleHeader); + row_size += 8; /* sequence_num */ + row_size += 4; /* count */ + row_size += 16; /* min/max */ + for (int attno = 0; attno < tupdesc->natts; attno++) + { + Form_pg_attribute attr = TupleDescAttr(tupdesc, attno); + + if (attr->attisdropped) + continue; + + row_size += 18; /* assume 18 bytes for each compressed column (varlena) */ + + if (strncmp(NameStr(attr->attname), + COMPRESSION_COLUMN_METADATA_PREFIX, + strlen(COMPRESSION_COLUMN_METADATA_PREFIX)) == 0) + elog(ERROR, + "cannot compress tables with reserved column prefix '%s'", + COMPRESSION_COLUMN_METADATA_PREFIX); + } + table_close(rel, AccessShareLock); + + if (row_size > MaxHeapTupleSize) + { + ereport(WARNING, + (errmsg("compressed row size might exceed maximum row size"), + errdetail("Estimated row size of compressed hypertable is %zu. This exceeds the " + "maximum size of %zu and can cause compression of chunks to fail.", + row_size, + MaxHeapTupleSize))); + } +} + static void compression_settings_update(CompressionSettings *settings, WithClauseResult *with_clause_options, List *segmentby_cols, List *orderby_cols) @@ -1244,18 +1035,22 @@ tsl_process_compress_table_add_column(Hypertable *ht, ColumnDef *orig_def) return; } - Hypertable *compress_ht = ts_hypertable_get_by_id(ht->fd.compressed_hypertable_id); - /* don't add column if it already exists */ - if (get_attnum(compress_ht->main_table_relid, orig_def->colname) != InvalidAttrNumber) - { - return; - } - + List *chunks = ts_chunk_get_by_hypertable_id(ht->fd.compressed_hypertable_id); + ListCell *lc; Oid coloid = LookupTypeNameOid(NULL, orig_def->typeName, false); - ColumnDef *coldef = build_columndef_singlecolumn(orig_def->colname, coloid); - CompressionSettings *settings = ts_compression_settings_get(ht->main_table_relid); - add_column_to_compression_table(compress_ht, settings, coldef); + foreach (lc, chunks) + { + Chunk *chunk = lfirst(lc); + /* don't add column if it already exists */ + if (get_attnum(chunk->table_id, orig_def->colname) != InvalidAttrNumber) + { + return; + } + ColumnDef *coldef = build_columndef_singlecolumn(orig_def->colname, coloid); + CompressionSettings *settings = ts_compression_settings_get(chunk->table_id); + add_column_to_compression_table(chunk->table_id, settings, coldef); + } } /* Drop a column from a table that has compression enabled @@ -1281,8 +1076,13 @@ tsl_process_compress_table_drop_column(Hypertable *ht, char *name) if (TS_HYPERTABLE_HAS_COMPRESSION_TABLE(ht)) { - Hypertable *compress_ht = ts_hypertable_get_by_id(ht->fd.compressed_hypertable_id); - drop_column_from_compression_table(compress_ht, name); + List *chunks = ts_chunk_get_by_hypertable_id(ht->fd.compressed_hypertable_id); + ListCell *lc; + foreach (lc, chunks) + { + Chunk *chunk = lfirst(lc); + drop_column_from_compression_table(chunk->table_id, name); + } } } @@ -1298,14 +1098,25 @@ tsl_process_compress_table_rename_column(Hypertable *ht, const RenameStmt *stmt) { Assert(stmt->relationType == OBJECT_TABLE && stmt->renameType == OBJECT_COLUMN); Assert(TS_HYPERTABLE_HAS_COMPRESSION_ENABLED(ht)); + + if (strncmp(stmt->newname, + COMPRESSION_COLUMN_METADATA_PREFIX, + strlen(COMPRESSION_COLUMN_METADATA_PREFIX)) == 0) + elog(ERROR, + "cannot compress tables with reserved column prefix '%s'", + COMPRESSION_COLUMN_METADATA_PREFIX); + if (TS_HYPERTABLE_HAS_COMPRESSION_TABLE(ht)) { - int32 compress_htid = ht->fd.compressed_hypertable_id; - Hypertable *compress_ht = ts_hypertable_get_by_id(compress_htid); - RenameStmt *compress_col_stmt = (RenameStmt *) copyObject(stmt); - compress_col_stmt->relation = makeRangeVar(NameStr(compress_ht->fd.schema_name), - NameStr(compress_ht->fd.table_name), - -1); - ExecRenameStmt(compress_col_stmt); + List *chunks = ts_chunk_get_by_hypertable_id(ht->fd.compressed_hypertable_id); + ListCell *lc; + foreach (lc, chunks) + { + Chunk *chunk = lfirst(lc); + RenameStmt *compress_col_stmt = (RenameStmt *) copyObject(stmt); + compress_col_stmt->relation = + makeRangeVar(NameStr(chunk->fd.schema_name), NameStr(chunk->fd.table_name), -1); + ExecRenameStmt(compress_col_stmt); + } } } diff --git a/tsl/test/expected/compression.out b/tsl/test/expected/compression.out index 3d3615bb670..b0326fcb8e0 100644 --- a/tsl/test/expected/compression.out +++ b/tsl/test/expected/compression.out @@ -633,15 +633,15 @@ END $$ LANGUAGE plpgsql; CALL reindex_compressed_hypertable('test_collation'); --segment bys are pushed down correctly EXPLAIN (costs off) SELECT * FROM test_collation WHERE device_id < 'a'; - QUERY PLAN ----------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------- Append -> Custom Scan (DecompressChunk) on _hyper_9_19_chunk - -> Seq Scan on compress_hyper_10_29_chunk - Filter: (device_id < 'a'::text) + -> Index Scan using compress_hyper_10_29_chunk_device_id_device_id_2__ts_meta_s_idx on compress_hyper_10_29_chunk + Index Cond: (device_id < 'a'::text) -> Custom Scan (DecompressChunk) on _hyper_9_20_chunk - -> Seq Scan on compress_hyper_10_30_chunk - Filter: (device_id < 'a'::text) + -> Index Scan using compress_hyper_10_30_chunk_device_id_device_id_2__ts_meta_s_idx on compress_hyper_10_30_chunk + Index Cond: (device_id < 'a'::text) -> Seq Scan on _hyper_9_21_chunk Filter: (device_id < 'a'::text) -> Seq Scan on _hyper_9_22_chunk @@ -1085,7 +1085,7 @@ WHERE table_name = :'CHUNK_NAME' AND constraint_type = 'FOREIGN KEY' ORDER BY constraint_name; constraint_schema | constraint_name | table_schema | table_name | constraint_type -----------------------+---------------------------+-----------------------+--------------------+----------------- - _timescaledb_internal | 42_9_hyper_device_id_fkey | _timescaledb_internal | _hyper_18_42_chunk | FOREIGN KEY + _timescaledb_internal | 42_8_hyper_device_id_fkey | _timescaledb_internal | _hyper_18_42_chunk | FOREIGN KEY (1 row) -- create hypertable with 2 chunks @@ -1512,7 +1512,7 @@ SELECT relname, reltuples, relpages, relallvisible FROM pg_class ORDER BY relname; relname | reltuples | relpages | relallvisible ----------------------------+-----------+----------+--------------- - compress_hyper_30_60_chunk | 1 | 1 | 0 + compress_hyper_30_60_chunk | -1 | 0 | 0 (1 row) --analyze on stattest2 should not overwrite @@ -1832,7 +1832,7 @@ SELECT * FROM f_sensor_data WHERE sensor_id > 100; Workers Planned: 2 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_71_chunk Output: _hyper_37_71_chunk."time", _hyper_37_71_chunk.sensor_id, _hyper_37_71_chunk.cpu, _hyper_37_71_chunk.temperature - -> Parallel Index Scan using compress_hyper_38_72_chunk__compressed_hypertable_38_sensor_id_ on _timescaledb_internal.compress_hyper_38_72_chunk + -> Parallel Index Scan using compress_hyper_38_72_chunk_sensor_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_38_72_chunk Output: compress_hyper_38_72_chunk."time", compress_hyper_38_72_chunk.sensor_id, compress_hyper_38_72_chunk.cpu, compress_hyper_38_72_chunk.temperature, compress_hyper_38_72_chunk._ts_meta_count, compress_hyper_38_72_chunk._ts_meta_sequence_num, compress_hyper_38_72_chunk._ts_meta_min_1, compress_hyper_38_72_chunk._ts_meta_max_1 Index Cond: (compress_hyper_38_72_chunk.sensor_id > 100) (8 rows) @@ -1880,15 +1880,15 @@ SELECT * FROM f_sensor_data WHERE sensor_id > 100; Output: _hyper_37_71_chunk."time", _hyper_37_71_chunk.sensor_id, _hyper_37_71_chunk.cpu, _hyper_37_71_chunk.temperature Workers Planned: 3 -> Parallel Append + -> Parallel Index Scan using _hyper_37_71_chunk_f_sensor_data_time_sensor_id_idx on _timescaledb_internal._hyper_37_71_chunk + Output: _hyper_37_71_chunk."time", _hyper_37_71_chunk.sensor_id, _hyper_37_71_chunk.cpu, _hyper_37_71_chunk.temperature + Index Cond: (_hyper_37_71_chunk.sensor_id > 100) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_71_chunk Output: _hyper_37_71_chunk."time", _hyper_37_71_chunk.sensor_id, _hyper_37_71_chunk.cpu, _hyper_37_71_chunk.temperature Filter: (_hyper_37_71_chunk.sensor_id > 100) - -> Parallel Index Scan using compress_hyper_38_72_chunk__compressed_hypertable_38_sensor_id_ on _timescaledb_internal.compress_hyper_38_72_chunk + -> Parallel Index Scan using compress_hyper_38_72_chunk_sensor_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_38_72_chunk Output: compress_hyper_38_72_chunk."time", compress_hyper_38_72_chunk.sensor_id, compress_hyper_38_72_chunk.cpu, compress_hyper_38_72_chunk.temperature, compress_hyper_38_72_chunk._ts_meta_count, compress_hyper_38_72_chunk._ts_meta_sequence_num, compress_hyper_38_72_chunk._ts_meta_min_1, compress_hyper_38_72_chunk._ts_meta_max_1 Index Cond: (compress_hyper_38_72_chunk.sensor_id > 100) - -> Parallel Index Scan using _hyper_37_71_chunk_f_sensor_data_time_sensor_id_idx on _timescaledb_internal._hyper_37_71_chunk - Output: _hyper_37_71_chunk."time", _hyper_37_71_chunk.sensor_id, _hyper_37_71_chunk.cpu, _hyper_37_71_chunk.temperature - Index Cond: (_hyper_37_71_chunk.sensor_id > 100) (13 rows) -- Test non-partial paths below append are not executed multiple times @@ -2098,7 +2098,7 @@ ORDER BY timestamp desc LIMIT 1 ) a ON true; -> Sort Output: compress_hyper_44_84_chunk."timestamp", compress_hyper_44_84_chunk.attr_id, compress_hyper_44_84_chunk.number_val, compress_hyper_44_84_chunk._ts_meta_count, compress_hyper_44_84_chunk._ts_meta_sequence_num, compress_hyper_44_84_chunk._ts_meta_min_1, compress_hyper_44_84_chunk._ts_meta_max_1 Sort Key: compress_hyper_44_84_chunk._ts_meta_max_1 DESC - -> Index Scan using compress_hyper_44_84_chunk__compressed_hypertable_44_attr_id__t on _timescaledb_internal.compress_hyper_44_84_chunk + -> Index Scan using compress_hyper_44_84_chunk_attr_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_44_84_chunk Output: compress_hyper_44_84_chunk."timestamp", compress_hyper_44_84_chunk.attr_id, compress_hyper_44_84_chunk.number_val, compress_hyper_44_84_chunk._ts_meta_count, compress_hyper_44_84_chunk._ts_meta_sequence_num, compress_hyper_44_84_chunk._ts_meta_min_1, compress_hyper_44_84_chunk._ts_meta_max_1 Index Cond: (compress_hyper_44_84_chunk.attr_id = "*VALUES*".column1) Filter: ((compress_hyper_44_84_chunk._ts_meta_max_1 > 'Fri Jun 30 00:00:00 2023'::timestamp without time zone) AND (compress_hyper_44_84_chunk._ts_meta_min_1 < 'Thu Jul 06 00:00:00 2023'::timestamp without time zone)) @@ -2109,7 +2109,7 @@ ORDER BY timestamp desc LIMIT 1 ) a ON true; -> Sort Output: compress_hyper_44_83_chunk."timestamp", compress_hyper_44_83_chunk.attr_id, compress_hyper_44_83_chunk.number_val, compress_hyper_44_83_chunk._ts_meta_count, compress_hyper_44_83_chunk._ts_meta_sequence_num, compress_hyper_44_83_chunk._ts_meta_min_1, compress_hyper_44_83_chunk._ts_meta_max_1 Sort Key: compress_hyper_44_83_chunk._ts_meta_max_1 DESC - -> Index Scan using compress_hyper_44_83_chunk__compressed_hypertable_44_attr_id__t on _timescaledb_internal.compress_hyper_44_83_chunk + -> Index Scan using compress_hyper_44_83_chunk_attr_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_44_83_chunk Output: compress_hyper_44_83_chunk."timestamp", compress_hyper_44_83_chunk.attr_id, compress_hyper_44_83_chunk.number_val, compress_hyper_44_83_chunk._ts_meta_count, compress_hyper_44_83_chunk._ts_meta_sequence_num, compress_hyper_44_83_chunk._ts_meta_min_1, compress_hyper_44_83_chunk._ts_meta_max_1 Index Cond: (compress_hyper_44_83_chunk.attr_id = "*VALUES*".column1) Filter: ((compress_hyper_44_83_chunk._ts_meta_max_1 > 'Fri Jun 30 00:00:00 2023'::timestamp without time zone) AND (compress_hyper_44_83_chunk._ts_meta_min_1 < 'Thu Jul 06 00:00:00 2023'::timestamp without time zone)) @@ -2120,7 +2120,7 @@ ORDER BY timestamp desc LIMIT 1 ) a ON true; -> Sort Output: compress_hyper_44_82_chunk."timestamp", compress_hyper_44_82_chunk.attr_id, compress_hyper_44_82_chunk.number_val, compress_hyper_44_82_chunk._ts_meta_count, compress_hyper_44_82_chunk._ts_meta_sequence_num, compress_hyper_44_82_chunk._ts_meta_min_1, compress_hyper_44_82_chunk._ts_meta_max_1 Sort Key: compress_hyper_44_82_chunk._ts_meta_max_1 DESC - -> Index Scan using compress_hyper_44_82_chunk__compressed_hypertable_44_attr_id__t on _timescaledb_internal.compress_hyper_44_82_chunk + -> Index Scan using compress_hyper_44_82_chunk_attr_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_44_82_chunk Output: compress_hyper_44_82_chunk."timestamp", compress_hyper_44_82_chunk.attr_id, compress_hyper_44_82_chunk.number_val, compress_hyper_44_82_chunk._ts_meta_count, compress_hyper_44_82_chunk._ts_meta_sequence_num, compress_hyper_44_82_chunk._ts_meta_min_1, compress_hyper_44_82_chunk._ts_meta_max_1 Index Cond: (compress_hyper_44_82_chunk.attr_id = "*VALUES*".column1) Filter: ((compress_hyper_44_82_chunk._ts_meta_max_1 > 'Fri Jun 30 00:00:00 2023'::timestamp without time zone) AND (compress_hyper_44_82_chunk._ts_meta_min_1 < 'Thu Jul 06 00:00:00 2023'::timestamp without time zone)) diff --git a/tsl/test/expected/compression_bgw-13.out b/tsl/test/expected/compression_bgw-13.out index 9b275da800c..55df44a557b 100644 --- a/tsl/test/expected/compression_bgw-13.out +++ b/tsl/test/expected/compression_bgw-13.out @@ -131,7 +131,6 @@ ERROR: relation is not a hypertable or continuous aggregate \set ON_ERROR_STOP 1 -- We're done with the table, so drop it. DROP TABLE IF EXISTS conditions CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_2_4_chunk NOTICE: drop cascades to view dummyv1 --TEST 7 --compression policy for smallint, integer or bigint based partition hypertable diff --git a/tsl/test/expected/compression_bgw-14.out b/tsl/test/expected/compression_bgw-14.out index fe7271683e9..59209815f30 100644 --- a/tsl/test/expected/compression_bgw-14.out +++ b/tsl/test/expected/compression_bgw-14.out @@ -131,7 +131,6 @@ ERROR: relation is not a hypertable or continuous aggregate \set ON_ERROR_STOP 1 -- We're done with the table, so drop it. DROP TABLE IF EXISTS conditions CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_2_4_chunk NOTICE: drop cascades to view dummyv1 --TEST 7 --compression policy for smallint, integer or bigint based partition hypertable diff --git a/tsl/test/expected/compression_bgw-15.out b/tsl/test/expected/compression_bgw-15.out index fe7271683e9..59209815f30 100644 --- a/tsl/test/expected/compression_bgw-15.out +++ b/tsl/test/expected/compression_bgw-15.out @@ -131,7 +131,6 @@ ERROR: relation is not a hypertable or continuous aggregate \set ON_ERROR_STOP 1 -- We're done with the table, so drop it. DROP TABLE IF EXISTS conditions CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_2_4_chunk NOTICE: drop cascades to view dummyv1 --TEST 7 --compression policy for smallint, integer or bigint based partition hypertable diff --git a/tsl/test/expected/compression_bgw-16.out b/tsl/test/expected/compression_bgw-16.out index fe7271683e9..59209815f30 100644 --- a/tsl/test/expected/compression_bgw-16.out +++ b/tsl/test/expected/compression_bgw-16.out @@ -131,7 +131,6 @@ ERROR: relation is not a hypertable or continuous aggregate \set ON_ERROR_STOP 1 -- We're done with the table, so drop it. DROP TABLE IF EXISTS conditions CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_2_4_chunk NOTICE: drop cascades to view dummyv1 --TEST 7 --compression policy for smallint, integer or bigint based partition hypertable diff --git a/tsl/test/expected/compression_create_compressed_table.out b/tsl/test/expected/compression_create_compressed_table.out index ccb2fcb07e8..26ff5efd9d9 100644 --- a/tsl/test/expected/compression_create_compressed_table.out +++ b/tsl/test/expected/compression_create_compressed_table.out @@ -32,7 +32,7 @@ SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); (1 row) -- create custom compressed chunk table -CREATE TABLE "_timescaledb_internal"."custom_compressed_chunk"() INHERITS ("_timescaledb_internal"."_compressed_hypertable_2"); +CREATE TABLE _timescaledb_internal.custom_compressed_chunk( LIKE _timescaledb_internal.compress_hyper_2_2_chunk); -- copy compressed row from compressed table into custom compressed chunk table INSERT INTO "_timescaledb_internal"."custom_compressed_chunk" SELECT * FROM "_timescaledb_internal"."compress_hyper_2_2_chunk"; -- decompress the rows, moving them back to uncompressed space diff --git a/tsl/test/expected/compression_ddl.out b/tsl/test/expected/compression_ddl.out index 36d1180bb66..fe7b2513066 100644 --- a/tsl/test/expected/compression_ddl.out +++ b/tsl/test/expected/compression_ddl.out @@ -158,7 +158,7 @@ FROM pg_tables WHERE tablespace = 'tablespace1'; (0 rows) \set ON_ERROR_STOP 0 -SELECT move_chunk(chunk=>:'COMPRESSED_CHUNK_NAME', destination_tablespace=>'tablespace1', index_destination_tablespace=>'tablespace1', reorder_index=>'_timescaledb_internal."compress_hyper_2_28_chunk__compressed_hypertable_2_b__ts_meta_s"'); +SELECT move_chunk(chunk=>:'COMPRESSED_CHUNK_NAME', destination_tablespace=>'tablespace1', index_destination_tablespace=>'tablespace1', reorder_index=>'_timescaledb_internal."compress_hyper_2_28_chunk_b__ts_meta_sequence_num_idx"'); ERROR: cannot directly move internal compression data \set ON_ERROR_STOP 1 -- ensure that both compressed and uncompressed chunks moved @@ -495,7 +495,7 @@ ERROR: cannot drop table _timescaledb_internal._compressed_hypertable_2 because \set ON_ERROR_STOP 1 BEGIN; DROP TABLE :UNCOMPRESSED_HYPER_NAME CASCADE; -NOTICE: drop cascades to 2 other objects +NOTICE: drop cascades to view dependent_1 SELECT count(*) FROM _timescaledb_catalog.hypertable hypertable; count ------- @@ -616,7 +616,6 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('test1') ch; (1 row) DROP TABLE test1 CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_7_57_chunk NOTICE: drop cascades to 2 other objects NOTICE: drop cascades to table _timescaledb_internal._hyper_5_56_chunk DROP TABLESPACE tablespace1; @@ -910,11 +909,11 @@ WHERE hypertable_id = ( SELECT id FROM _timescaledb_catalog.hypertable 7 (1 row) -SELECT count(*) -FROM ( SELECT attrelid::regclass, attname FROM pg_attribute - WHERE attrelid in (SELECT inhrelid::regclass from pg_inherits - where inhparent = 'test1'::regclass) - and attname = 'bigintcol' ) q; +SELECT count(*) FROM pg_attribute att +INNER JOIN _timescaledb_catalog.chunk ch ON att.attrelid = format('%I.%I', ch.schema_name, ch.table_name)::regclass +INNER JOIN _timescaledb_catalog.hypertable ht ON ht.id = ch.hypertable_id AND ht.table_name = 'test1' +WHERE + attname = 'bigintcol'; count ------- 7 @@ -925,11 +924,11 @@ FROM ( SELECT attrelid::regclass, attname FROM pg_attribute SELECT format('%I.%I', cht.schema_name, cht.table_name) AS "COMPRESSION_TBLNM" FROM _timescaledb_catalog.hypertable ht, _timescaledb_catalog.hypertable cht WHERE ht.table_name = 'test1' and cht.id = ht.compressed_hypertable_id \gset -SELECT count(*) -FROM ( SELECT attrelid::regclass, attname FROM pg_attribute - WHERE attrelid in (SELECT inhrelid::regclass from pg_inherits - where inhparent = :'COMPRESSION_TBLNM'::regclass ) - and attname = 'bigintcol' ) q; +SELECT count(*) FROM pg_attribute att +INNER JOIN _timescaledb_catalog.chunk ch ON att.attrelid = format('%I.%I', ch.schema_name, ch.table_name)::regclass +INNER JOIN _timescaledb_catalog.hypertable ht ON ht.compressed_hypertable_id = ch.hypertable_id AND ht.table_name = 'test1' +WHERE + attname = 'bigintcol'; count ------- 7 @@ -953,11 +952,11 @@ WHERE hypertable_name = 'test1' and attname like 'ccc%'; public | test1 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccca | 1 | | | (1 row) -SELECT count(*) -FROM ( SELECT attrelid::regclass, attname FROM pg_attribute - WHERE attrelid in (SELECT inhrelid::regclass from pg_inherits - where inhparent = :'COMPRESSION_TBLNM'::regclass ) - and attname like 'ccc%a' ) q; +SELECT count(*) FROM pg_attribute att +INNER JOIN _timescaledb_catalog.chunk ch ON att.attrelid = format('%I.%I', ch.schema_name, ch.table_name)::regclass +INNER JOIN _timescaledb_catalog.hypertable ht ON ht.compressed_hypertable_id = ch.hypertable_id AND ht.table_name = 'test1' +WHERE + attname like 'ccc%a'; count ------- 7 @@ -1189,16 +1188,13 @@ ALTER TABLE test2 set (timescaledb.compress, timescaledb.compress_segmentby = 'i SELECT regexp_replace(relname, 'pg_toast_[0-9]+', 'pg_toast_XXX') FROM pg_class WHERE reltablespace in ( SELECT oid from pg_tablespace WHERE spcname = 'tablespace2') ORDER BY 1; - regexp_replace -------------------------------------------------------- + regexp_replace +------------------------------------- _compressed_hypertable_20 - _compressed_hypertable_20_i__ts_meta_sequence_num_idx _hyper_19_107_chunk _hyper_19_107_chunk_test2_timec_idx - pg_toast_XXX - pg_toast_XXX_index test2 -(7 rows) +(4 rows) -- test compress_chunk() with utility statement (SELECT ... INTO) SELECT compress_chunk(ch) INTO compressed_chunks FROM show_chunks('test2') ch; @@ -1219,11 +1215,10 @@ WHERE reltablespace in ( SELECT oid from pg_tablespace WHERE spcname = 'tablespace2'))q; count ------- - 11 + 8 (1 row) DROP TABLE test2 CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_20_109_chunk DROP TABLESPACE tablespace2; -- Create a table with a compressed table and then delete the -- compressed table and see that the drop of the hypertable does not @@ -1281,18 +1276,9 @@ INNER JOIN _timescaledb_catalog.hypertable comp_hypertable ON (comp_hypertable.i WHERE uc_hypertable.table_name like 'metric' \gset -- get definition of compressed hypertable and notice the index \d :COMP_SCHEMA_NAME.:COMP_TABLE_NAME - Table "_timescaledb_internal._compressed_hypertable_24" - Column | Type | Collation | Nullable | Default ------------------------+---------------------------------------+-----------+----------+--------- - time | _timescaledb_internal.compressed_data | | | - value | double precision | | | - series_id | bigint | | | - _ts_meta_count | integer | | | - _ts_meta_sequence_num | integer | | | - _ts_meta_min_1 | timestamp with time zone | | | - _ts_meta_max_1 | timestamp with time zone | | | -Indexes: - "_compressed_hypertable_24_series_id_value__ts_meta_sequence_idx" btree (series_id, value, _ts_meta_sequence_num) +Table "_timescaledb_internal._compressed_hypertable_24" + Column | Type | Collation | Nullable | Default +--------+------+-----------+----------+--------- Triggers: ts_insert_blocker BEFORE INSERT ON _timescaledb_internal._compressed_hypertable_24 FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.insert_blocker() @@ -1414,7 +1400,7 @@ ORDER BY device_id; -> Partial GroupAggregate Group Key: _hyper_32_110_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_110_chunk - -> Index Scan using compress_hyper_33_111_chunk__compressed_hypertable_33_device_id on compress_hyper_33_111_chunk + -> Index Scan using compress_hyper_33_111_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_111_chunk -> Partial GroupAggregate Group Key: _hyper_32_110_chunk.device_id -> Index Only Scan using _hyper_32_110_chunk_compression_insert_device_id_time_idx on _hyper_32_110_chunk @@ -1494,11 +1480,11 @@ ORDER BY device_id; -> Partial GroupAggregate Group Key: _hyper_32_110_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_110_chunk - -> Index Scan using compress_hyper_33_111_chunk__compressed_hypertable_33_device_id on compress_hyper_33_111_chunk + -> Index Scan using compress_hyper_33_111_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_111_chunk -> Partial GroupAggregate Group Key: _hyper_32_112_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_112_chunk - -> Index Scan using compress_hyper_33_113_chunk__compressed_hypertable_33_device_id on compress_hyper_33_113_chunk + -> Index Scan using compress_hyper_33_113_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_113_chunk -> Partial GroupAggregate Group Key: _hyper_32_112_chunk.device_id -> Index Only Scan using _hyper_32_112_chunk_compression_insert_device_id_time_idx on _hyper_32_112_chunk @@ -1578,15 +1564,15 @@ ORDER BY device_id; -> Partial GroupAggregate Group Key: _hyper_32_110_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_110_chunk - -> Index Scan using compress_hyper_33_111_chunk__compressed_hypertable_33_device_id on compress_hyper_33_111_chunk + -> Index Scan using compress_hyper_33_111_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_111_chunk -> Partial GroupAggregate Group Key: _hyper_32_112_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_112_chunk - -> Index Scan using compress_hyper_33_113_chunk__compressed_hypertable_33_device_id on compress_hyper_33_113_chunk + -> Index Scan using compress_hyper_33_113_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_113_chunk -> Partial GroupAggregate Group Key: _hyper_32_114_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_114_chunk - -> Index Scan using compress_hyper_33_115_chunk__compressed_hypertable_33_device_id on compress_hyper_33_115_chunk + -> Index Scan using compress_hyper_33_115_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_115_chunk -> Partial GroupAggregate Group Key: _hyper_32_114_chunk.device_id -> Index Only Scan using _hyper_32_114_chunk_compression_insert_device_id_time_idx on _hyper_32_114_chunk @@ -1666,19 +1652,19 @@ ORDER BY device_id; -> Partial GroupAggregate Group Key: _hyper_32_110_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_110_chunk - -> Index Scan using compress_hyper_33_111_chunk__compressed_hypertable_33_device_id on compress_hyper_33_111_chunk + -> Index Scan using compress_hyper_33_111_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_111_chunk -> Partial GroupAggregate Group Key: _hyper_32_112_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_112_chunk - -> Index Scan using compress_hyper_33_113_chunk__compressed_hypertable_33_device_id on compress_hyper_33_113_chunk + -> Index Scan using compress_hyper_33_113_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_113_chunk -> Partial GroupAggregate Group Key: _hyper_32_114_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_114_chunk - -> Index Scan using compress_hyper_33_115_chunk__compressed_hypertable_33_device_id on compress_hyper_33_115_chunk + -> Index Scan using compress_hyper_33_115_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_115_chunk -> Partial GroupAggregate Group Key: _hyper_32_116_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_116_chunk - -> Index Scan using compress_hyper_33_117_chunk__compressed_hypertable_33_device_id on compress_hyper_33_117_chunk + -> Index Scan using compress_hyper_33_117_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_117_chunk -> Partial GroupAggregate Group Key: _hyper_32_116_chunk.device_id -> Index Only Scan using _hyper_32_116_chunk_compression_insert_device_id_time_idx on _hyper_32_116_chunk @@ -1758,23 +1744,23 @@ ORDER BY device_id; -> Partial GroupAggregate Group Key: _hyper_32_110_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_110_chunk - -> Index Scan using compress_hyper_33_111_chunk__compressed_hypertable_33_device_id on compress_hyper_33_111_chunk + -> Index Scan using compress_hyper_33_111_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_111_chunk -> Partial GroupAggregate Group Key: _hyper_32_112_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_112_chunk - -> Index Scan using compress_hyper_33_113_chunk__compressed_hypertable_33_device_id on compress_hyper_33_113_chunk + -> Index Scan using compress_hyper_33_113_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_113_chunk -> Partial GroupAggregate Group Key: _hyper_32_114_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_114_chunk - -> Index Scan using compress_hyper_33_115_chunk__compressed_hypertable_33_device_id on compress_hyper_33_115_chunk + -> Index Scan using compress_hyper_33_115_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_115_chunk -> Partial GroupAggregate Group Key: _hyper_32_116_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_116_chunk - -> Index Scan using compress_hyper_33_117_chunk__compressed_hypertable_33_device_id on compress_hyper_33_117_chunk + -> Index Scan using compress_hyper_33_117_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_117_chunk -> Partial GroupAggregate Group Key: _hyper_32_118_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_32_118_chunk - -> Index Scan using compress_hyper_33_119_chunk__compressed_hypertable_33_device_id on compress_hyper_33_119_chunk + -> Index Scan using compress_hyper_33_119_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_33_119_chunk -> Partial GroupAggregate Group Key: _hyper_32_118_chunk.device_id -> Index Only Scan using _hyper_32_118_chunk_compression_insert_device_id_time_idx on _hyper_32_118_chunk diff --git a/tsl/test/expected/compression_hypertable.out b/tsl/test/expected/compression_hypertable.out index 0c3f76b259d..39a28c04386 100644 --- a/tsl/test/expected/compression_hypertable.out +++ b/tsl/test/expected/compression_hypertable.out @@ -134,21 +134,13 @@ SELECT DISTINCT attname, attstattarget WHERE attrelid = '_timescaledb_internal._compressed_hypertable_2'::REGCLASS AND attnum > 0 ORDER BY attname; - attname | attstattarget ------------------------+--------------- - Time | 0 - _ts_meta_count | 1000 - _ts_meta_max_1 | 1000 - _ts_meta_min_1 | 1000 - _ts_meta_sequence_num | 1000 - b | 0 - i | 0 - t | 0 -(8 rows) + attname | attstattarget +---------+--------------- +(0 rows) SELECT DISTINCT attname, attstattarget FROM pg_attribute - WHERE attrelid in (SELECT "Child" FROM test.show_subtables('_timescaledb_internal._compressed_hypertable_2')) + WHERE attrelid in (SELECT format('%I.%I', schema_name, table_name)::regclass FROM _timescaledb_catalog.chunk ch WHERE ch.hypertable_id = 2) AND attnum > 0 ORDER BY attname; attname | attstattarget @@ -197,17 +189,15 @@ SELECT * FROM test1; /* nor compressed table */ SELECT * FROM _timescaledb_internal._compressed_hypertable_2; - Time | i | b | t | _ts_meta_count | _ts_meta_sequence_num | _ts_meta_min_1 | _ts_meta_max_1 -------+---+---+---+----------------+-----------------------+----------------+---------------- +-- (0 rows) -/* the compressed table should have not chunks */ -EXPLAIN (costs off) SELECT * FROM _timescaledb_internal._compressed_hypertable_2; - QUERY PLAN --------------------------- - Result - One-Time Filter: false -(2 rows) +/* the compressed table should not have chunks */ +SELECT count(*) FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2; + count +------- + 0 +(1 row) --add test for altered hypertable CREATE TABLE test2 ("Time" timestamptz, i integer, b bigint, t text); @@ -407,22 +397,13 @@ SELECT DISTINCT attname, attstattarget WHERE attrelid = '_timescaledb_internal._compressed_hypertable_6'::REGCLASS AND attnum > 0 ORDER BY attname; - attname | attstattarget ------------------------+--------------- - _ts_meta_count | 1000 - _ts_meta_max_1 | 1000 - _ts_meta_min_1 | 1000 - _ts_meta_sequence_num | 1000 - humidity | 0 - location | 1000 - location2 | 0 - temperature | 0 - timec | 0 -(9 rows) + attname | attstattarget +---------+--------------- +(0 rows) SELECT DISTINCT attname, attstattarget FROM pg_attribute - WHERE attrelid in (SELECT "Child" FROM test.show_subtables('_timescaledb_internal._compressed_hypertable_6')) + WHERE attrelid in (SELECT format('%I.%I', schema_name, table_name)::regclass FROM _timescaledb_catalog.chunk ch WHERE ch.hypertable_id = 6) AND attnum > 0 ORDER BY attname; attname | attstattarget diff --git a/tsl/test/expected/compression_permissions.out b/tsl/test/expected/compression_permissions.out index 16b12bc19b5..b893da7f95f 100644 --- a/tsl/test/expected/compression_permissions.out +++ b/tsl/test/expected/compression_permissions.out @@ -153,7 +153,6 @@ select count(*) from v2; ERROR: permission denied for table conditions \c :TEST_DBNAME :ROLE_SUPERUSER DROP TABLE conditions CASCADE; -NOTICE: drop cascades to 2 other objects NOTICE: drop cascades to view v2 -- Testing that permissions propagate to compressed hypertables and to -- compressed chunks. diff --git a/tsl/test/expected/compression_qualpushdown.out b/tsl/test/expected/compression_qualpushdown.out index 276ec29b58b..02f0a256f66 100644 --- a/tsl/test/expected/compression_qualpushdown.out +++ b/tsl/test/expected/compression_qualpushdown.out @@ -236,7 +236,7 @@ EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar'; QUERY PLAN -------------------------------------------------------------------------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_5_6_chunk - -> Index Scan using compress_hyper_6_7_chunk__compressed_hypertable_6_dev_vc_dev_c_ on compress_hyper_6_7_chunk + -> Index Scan using compress_hyper_6_7_chunk_dev_vc_dev_c__ts_meta_sequence_num_idx on compress_hyper_6_7_chunk Index Cond: ((dev_vc)::text = 'varchar'::text) (3 rows) @@ -244,7 +244,7 @@ EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_c = 'char'; QUERY PLAN -------------------------------------------------------------------------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_5_6_chunk - -> Index Scan using compress_hyper_6_7_chunk__compressed_hypertable_6_dev_vc_dev_c_ on compress_hyper_6_7_chunk + -> Index Scan using compress_hyper_6_7_chunk_dev_vc_dev_c__ts_meta_sequence_num_idx on compress_hyper_6_7_chunk Index Cond: (dev_c = 'char'::bpchar) (3 rows) @@ -252,7 +252,7 @@ EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar' AND QUERY PLAN -------------------------------------------------------------------------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_5_6_chunk - -> Index Scan using compress_hyper_6_7_chunk__compressed_hypertable_6_dev_vc_dev_c_ on compress_hyper_6_7_chunk + -> Index Scan using compress_hyper_6_7_chunk_dev_vc_dev_c__ts_meta_sequence_num_idx on compress_hyper_6_7_chunk Index Cond: (((dev_vc)::text = 'varchar'::text) AND (dev_c = 'char'::bpchar)) (3 rows) @@ -260,7 +260,7 @@ EXPLAIN (costs off) SELECT * FROM pushdown_relabel WHERE dev_vc = 'varchar'::cha QUERY PLAN -------------------------------------------------------------------------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_5_6_chunk - -> Index Scan using compress_hyper_6_7_chunk__compressed_hypertable_6_dev_vc_dev_c_ on compress_hyper_6_7_chunk + -> Index Scan using compress_hyper_6_7_chunk_dev_vc_dev_c__ts_meta_sequence_num_idx on compress_hyper_6_7_chunk Index Cond: (dev_c = 'char'::bpchar) Filter: ((dev_vc)::bpchar = 'varchar '::character(10)) (4 rows) @@ -326,11 +326,11 @@ SELECT compress_chunk(i) FROM show_chunks('deleteme_with_bytea') i; (1 row) EXPLAIN (costs off) SELECT '1' FROM deleteme_with_bytea WHERE bdata = E'\\x'; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Result -> Custom Scan (DecompressChunk) on _hyper_9_10_chunk - -> Index Scan using compress_hyper_10_11_chunk__compressed_hypertable_10_bdata__ts_ on compress_hyper_10_11_chunk + -> Index Scan using compress_hyper_10_11_chunk_bdata__ts_meta_sequence_num_idx on compress_hyper_10_11_chunk Index Cond: (bdata = '\x'::bytea) (4 rows) @@ -369,7 +369,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_date = CURRENT_DATE; Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_date = CURRENT_DATE) (5 rows) @@ -379,7 +379,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_timetz = CURRENT_TIME; Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_timetz = CURRENT_TIME) (5 rows) @@ -389,7 +389,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_timetz = CURRENT_TIME(1); Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_timetz = CURRENT_TIME(1)) (5 rows) @@ -399,7 +399,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_timestamp = CURRENT_TIMES Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_timestamp = CURRENT_TIMESTAMP) (5 rows) @@ -409,7 +409,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_timestamp = CURRENT_TIMES Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_timestamp = CURRENT_TIMESTAMP(1)) (5 rows) @@ -419,7 +419,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_time = LOCALTIME; Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_time = LOCALTIME) (5 rows) @@ -429,7 +429,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_time = LOCALTIME(1); Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_time = LOCALTIME(1)) (5 rows) @@ -439,7 +439,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_timestamp = LOCALTIMESTAM Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_timestamp = LOCALTIMESTAMP) (5 rows) @@ -449,7 +449,7 @@ EXPLAIN (costs off) SELECT * FROM svf_pushdown WHERE c_timestamp = LOCALTIMESTAM Custom Scan (ChunkAppend) on svf_pushdown Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_c_date_c_t on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_c_date_c_time_c_timetz_c_timesta_idx on compress_hyper_12_13_chunk Index Cond: (c_timestamp = LOCALTIMESTAMP(1)) (5 rows) diff --git a/tsl/test/expected/compression_sorted_merge-13.out b/tsl/test/expected/compression_sorted_merge-13.out index 46ed67823b9..289c67d0598 100644 --- a/tsl/test/expected/compression_sorted_merge-13.out +++ b/tsl/test/expected/compression_sorted_merge-13.out @@ -1440,7 +1440,7 @@ SELECT time, segment_by, x1 FROM test_costs WHERE segment_by > 900 and segment_b Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Sort Key: compress_hyper_10_22_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Index Scan using compress_hyper_10_22_chunk__compressed_hypertable_10_segment_by on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) + -> Index Scan using compress_hyper_10_22_chunk_segment_by__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Index Cond: ((compress_hyper_10_22_chunk.segment_by > 900) AND (compress_hyper_10_22_chunk.segment_by < 999)) (11 rows) diff --git a/tsl/test/expected/compression_sorted_merge-14.out b/tsl/test/expected/compression_sorted_merge-14.out index 46ed67823b9..289c67d0598 100644 --- a/tsl/test/expected/compression_sorted_merge-14.out +++ b/tsl/test/expected/compression_sorted_merge-14.out @@ -1440,7 +1440,7 @@ SELECT time, segment_by, x1 FROM test_costs WHERE segment_by > 900 and segment_b Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Sort Key: compress_hyper_10_22_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Index Scan using compress_hyper_10_22_chunk__compressed_hypertable_10_segment_by on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) + -> Index Scan using compress_hyper_10_22_chunk_segment_by__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Index Cond: ((compress_hyper_10_22_chunk.segment_by > 900) AND (compress_hyper_10_22_chunk.segment_by < 999)) (11 rows) diff --git a/tsl/test/expected/compression_sorted_merge-15.out b/tsl/test/expected/compression_sorted_merge-15.out index 7ab9bd49f70..d5848d31e55 100644 --- a/tsl/test/expected/compression_sorted_merge-15.out +++ b/tsl/test/expected/compression_sorted_merge-15.out @@ -1440,7 +1440,7 @@ SELECT time, segment_by, x1 FROM test_costs WHERE segment_by > 900 and segment_b Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Sort Key: compress_hyper_10_22_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Index Scan using compress_hyper_10_22_chunk__compressed_hypertable_10_segment_by on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) + -> Index Scan using compress_hyper_10_22_chunk_segment_by__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Index Cond: ((compress_hyper_10_22_chunk.segment_by > 900) AND (compress_hyper_10_22_chunk.segment_by < 999)) (11 rows) diff --git a/tsl/test/expected/compression_sorted_merge-16.out b/tsl/test/expected/compression_sorted_merge-16.out index 7ab9bd49f70..d5848d31e55 100644 --- a/tsl/test/expected/compression_sorted_merge-16.out +++ b/tsl/test/expected/compression_sorted_merge-16.out @@ -1440,7 +1440,7 @@ SELECT time, segment_by, x1 FROM test_costs WHERE segment_by > 900 and segment_b Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Sort Key: compress_hyper_10_22_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Index Scan using compress_hyper_10_22_chunk__compressed_hypertable_10_segment_by on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) + -> Index Scan using compress_hyper_10_22_chunk_segment_by__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_10_22_chunk (actual rows=98 loops=1) Output: compress_hyper_10_22_chunk."time", compress_hyper_10_22_chunk.segment_by, compress_hyper_10_22_chunk.x1, compress_hyper_10_22_chunk._ts_meta_count, compress_hyper_10_22_chunk._ts_meta_sequence_num, compress_hyper_10_22_chunk._ts_meta_min_1, compress_hyper_10_22_chunk._ts_meta_max_1, compress_hyper_10_22_chunk._ts_meta_min_2, compress_hyper_10_22_chunk._ts_meta_max_2 Index Cond: ((compress_hyper_10_22_chunk.segment_by > 900) AND (compress_hyper_10_22_chunk.segment_by < 999)) (11 rows) diff --git a/tsl/test/expected/compression_sorted_merge_distinct.out b/tsl/test/expected/compression_sorted_merge_distinct.out index f98aeff708d..65eb802ce68 100644 --- a/tsl/test/expected/compression_sorted_merge_distinct.out +++ b/tsl/test/expected/compression_sorted_merge_distinct.out @@ -44,7 +44,7 @@ explain (costs off) select * from t where low_card = 1 order by ts; Sort Sort Key: _hyper_1_1_chunk.ts -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: (low_card = 1) (5 rows) @@ -54,7 +54,7 @@ explain (costs off) select * from t where high_card = 1 order by ts; Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Sort Sort Key: compress_hyper_2_2_chunk._ts_meta_min_1 - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: (high_card = 1) (5 rows) @@ -64,7 +64,7 @@ explain (costs off) select * from t where low_card = 1 and high_card = 1 order b Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Sort Sort Key: compress_hyper_2_2_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: ((low_card = 1) AND (high_card = 1)) (5 rows) @@ -77,7 +77,7 @@ explain (costs off) select * from t where high_card = 1 order by ts; Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Sort Sort Key: compress_hyper_2_2_chunk._ts_meta_min_1 - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: (high_card = 1) (5 rows) @@ -89,7 +89,7 @@ explain (costs off) select * from t where high_card < 10 order by ts; Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Sort Sort Key: compress_hyper_2_2_chunk._ts_meta_min_1 - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: (high_card < 10) (5 rows) @@ -111,7 +111,7 @@ explain (costs off) select * from t where high_card < 10 order by ts; Sort Sort Key: _hyper_1_1_chunk.ts -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: (high_card < 10) (5 rows) @@ -128,7 +128,7 @@ explain (costs off) select * from t where high_card < 10 order by ts; Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Sort Sort Key: compress_hyper_2_2_chunk._ts_meta_min_1 - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_low_card_high on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_low_card_high_card__ts_meta_sequen_idx on compress_hyper_2_2_chunk Index Cond: (high_card < 10) (5 rows) diff --git a/tsl/test/expected/compression_update_delete.out b/tsl/test/expected/compression_update_delete.out index 0684ffa90c0..03e90c244ca 100644 --- a/tsl/test/expected/compression_update_delete.out +++ b/tsl/test/expected/compression_update_delete.out @@ -1329,7 +1329,7 @@ SELECT COUNT(*) AS "total_rows" FROM sample_table \gset SELECT COUNT(*) AS "total_affected_rows" FROM sample_table WHERE c4 = 5 \gset -- delete 10k rows DELETE FROM sample_table WHERE c4 = 5; -INFO: Index "compress_hyper_20_38_chunk__compressed_hypertable_20_c4__ts_met" is used for scan. +INFO: Index "compress_hyper_20_38_chunk_c4__ts_meta_sequence_num_idx" is used for scan. INFO: Number of compressed rows fetched from index: 10. Number of compressed rows filtered by heap filters: 0. -- report 0 rows SELECT count(*) FROM sample_table WHERE c4 = 5; @@ -1382,7 +1382,7 @@ SELECT COUNT(*) AS "total_rows" FROM sample_table \gset SELECT COUNT(*) AS "total_affected_rows" FROM sample_table WHERE c4 < 5 \gset -- delete 50k rows DELETE FROM sample_table WHERE c4 < 5; -INFO: Index "compress_hyper_20_38_chunk__compressed_hypertable_20_c4__ts_met" is used for scan. +INFO: Index "compress_hyper_20_38_chunk_c4__ts_meta_sequence_num_idx" is used for scan. INFO: Number of compressed rows fetched from index: 50. Number of compressed rows filtered by heap filters: 0. -- report 0 rows SELECT count(*) FROM sample_table WHERE c4 < 5; @@ -1435,7 +1435,7 @@ SELECT COUNT(*) AS "total_rows" FROM sample_table \gset SELECT COUNT(*) AS "total_affected_rows" FROM sample_table WHERE c4 >= 5 \gset -- delete 50k rows DELETE FROM sample_table WHERE c4 >= 5; -INFO: Index "compress_hyper_20_38_chunk__compressed_hypertable_20_c4__ts_met" is used for scan. +INFO: Index "compress_hyper_20_38_chunk_c4__ts_meta_sequence_num_idx" is used for scan. INFO: Number of compressed rows fetched from index: 50. Number of compressed rows filtered by heap filters: 0. -- report 0 rows SELECT count(*) FROM sample_table WHERE c4 >= 5; @@ -1649,7 +1649,7 @@ SELECT COUNT(*) AS "total_rows" FROM sample_table \gset SELECT COUNT(*) AS "total_affected_rows" FROM sample_table WHERE c4 = 5 and c1 = 5 \gset -- delete 1k rows DELETE FROM sample_table WHERE c4 = 5 and c1 = 5; -INFO: Index "compress_hyper_20_38_chunk__compressed_hypertable_20_c4__ts_met" is used for scan. +INFO: Index "compress_hyper_20_38_chunk_c4__ts_meta_sequence_num_idx" is used for scan. INFO: Number of compressed rows fetched from index: 10. Number of compressed rows filtered by heap filters: 9. -- report 0 rows SELECT count(*) FROM sample_table WHERE c4 = 5 and c1 = 5; @@ -1704,7 +1704,7 @@ SELECT COUNT(*) AS "total_rows" FROM sample_table \gset SELECT COUNT(*) AS "total_affected_rows" FROM sample_table WHERE c4 > 5 and c2 = 5 \gset -- delete 4k rows DELETE FROM sample_table WHERE c4 > 5 and c2 = 5; -INFO: Index "compress_hyper_20_38_chunk__compressed_hypertable_20_c4__ts_met" is used for scan. +INFO: Index "compress_hyper_20_38_chunk_c4__ts_meta_sequence_num_idx" is used for scan. INFO: Number of compressed rows fetched from index: 40. Number of compressed rows filtered by heap filters: 0. -- report 0 rows SELECT count(*) FROM sample_table WHERE c4 > 5 and c2 = 5; @@ -1767,7 +1767,7 @@ SELECT COUNT(*) FROM :COMPRESS_CHUNK_1 WHERE c4 = 4 AND _ts_meta_max_1 >= 7; SELECT COUNT(*) AS "total_rows" FROM :COMPRESS_CHUNK_1 WHERE c4 = 4 \gset SELECT COUNT(*) AS "total_affected_rows" FROM :COMPRESS_CHUNK_1 WHERE c4 = 4 AND _ts_meta_max_1 >= 7 \gset UPDATE sample_table SET c3 = c3 + 0 WHERE c4 = 4 AND c1 >= 7; -INFO: Index "compress_hyper_20_38_chunk__compressed_hypertable_20_c4__ts_met" is used for scan. +INFO: Index "compress_hyper_20_38_chunk_c4__ts_meta_sequence_num_idx" is used for scan. INFO: Number of compressed rows fetched from index: 10. Number of compressed rows filtered by heap filters: 7. -- report 7 rows SELECT COUNT(*) FROM :COMPRESS_CHUNK_1 WHERE c4 = 4; @@ -2374,23 +2374,24 @@ SELECT create_hypertable('tab1','time',create_default_indexes:=false); INSERT INTO tab1(filler_1, filler_2, filler_3,time,device_id,v0,v1,v2,v3) SELECT device_id, device_id+1, device_id + 2, time, device_id, device_id+1, device_id + 2, device_id + 0.5, NULL FROM generate_series('2000-01-01 0:00:00+0'::timestamptz,'2000-01-05 23:55:00+0','2m') gtime(time), generate_series(1,5,1) gdevice(device_id); ALTER TABLE tab1 SET (timescaledb.compress, timescaledb.compress_orderby='time DESC', timescaledb.compress_segmentby='device_id, filler_1, filler_2, filler_3'); --- create multiple indexes on compressed hypertable -DROP INDEX _timescaledb_internal._compressed_hypertable_2_device_id_filler_1_filler_2_filler_idx; -CREATE INDEX ON _timescaledb_internal._compressed_hypertable_2 (_ts_meta_min_1); -CREATE INDEX ON _timescaledb_internal._compressed_hypertable_2 (_ts_meta_min_1, _ts_meta_sequence_num); -CREATE INDEX ON _timescaledb_internal._compressed_hypertable_2 (_ts_meta_min_1, _ts_meta_max_1, filler_1); -CREATE INDEX filler_1 ON _timescaledb_internal._compressed_hypertable_2 (filler_1); -CREATE INDEX filler_2 ON _timescaledb_internal._compressed_hypertable_2 (filler_2); -CREATE INDEX filler_3 ON _timescaledb_internal._compressed_hypertable_2 (filler_3); --- below indexes should be selected -CREATE INDEX filler_1_filler_2 ON _timescaledb_internal._compressed_hypertable_2 (filler_1, filler_2); -CREATE INDEX filler_2_filler_3 ON _timescaledb_internal._compressed_hypertable_2 (filler_2, filler_3); SELECT compress_chunk(show_chunks('tab1')); compress_chunk ---------------------------------------- _timescaledb_internal._hyper_1_1_chunk (1 row) +SELECT format('%I.%I', schema_name, table_name) AS "CHUNK" FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2 \gset +-- create multiple indexes on compressed hypertable +DROP INDEX _timescaledb_internal.compress_hyper_2_2_chunk_device_id_filler_1_filler_2_filler_idx; +CREATE INDEX ON :CHUNK (_ts_meta_min_1); +CREATE INDEX ON :CHUNK (_ts_meta_min_1, _ts_meta_sequence_num); +CREATE INDEX ON :CHUNK (_ts_meta_min_1, _ts_meta_max_1, filler_1); +CREATE INDEX filler_1 ON :CHUNK (filler_1); +CREATE INDEX filler_2 ON :CHUNK (filler_2); +CREATE INDEX filler_3 ON :CHUNK (filler_3); +-- below indexes should be selected +CREATE INDEX filler_1_filler_2 ON :CHUNK (filler_1, filler_2); +CREATE INDEX filler_2_filler_3 ON :CHUNK (filler_2, filler_3); set timescaledb.debug_compression_path_info to on; BEGIN; SELECT COUNT(*) FROM tab1 WHERE filler_3 = 5 AND filler_2 = 4; @@ -2400,7 +2401,7 @@ SELECT COUNT(*) FROM tab1 WHERE filler_3 = 5 AND filler_2 = 4; (1 row) UPDATE tab1 SET v0 = v1 + v2 WHERE filler_3 = 5 AND filler_2 = 4; -INFO: Index "compress_hyper_2_2_chunk_filler_2_filler_3" is used for scan. +INFO: Index "filler_2_filler_3" is used for scan. INFO: Number of compressed rows fetched from index: 4. Number of compressed rows filtered by heap filters: 0. ROLLBACK; BEGIN; @@ -2411,7 +2412,7 @@ SELECT COUNT(*) FROM tab1 WHERE filler_1 < 5 AND filler_2 = 4; (1 row) UPDATE tab1 SET v0 = v1 + v2 WHERE filler_1 < 5 AND filler_2 = 4; -INFO: Index "compress_hyper_2_2_chunk_filler_1_filler_2" is used for scan. +INFO: Index "filler_1_filler_2" is used for scan. INFO: Number of compressed rows fetched from index: 4. Number of compressed rows filtered by heap filters: 0. ROLLBACK; -- idealy filler_1 index should be selected, @@ -2424,7 +2425,7 @@ SELECT COUNT(*) FROM tab1 WHERE filler_1 < 5; (1 row) UPDATE tab1 SET v0 = v1 + v2 WHERE filler_1 < 5; -INFO: Index "compress_hyper_2_2_chunk__compressed_hypertable_2__ts_meta_mi_2" is used for scan. +INFO: Index "compress_hyper_2_2_chunk__ts_meta_min_1__ts_meta_max_1_fill_idx" is used for scan. INFO: Number of compressed rows fetched from index: 16. Number of compressed rows filtered by heap filters: 0. ROLLBACK; RESET timescaledb.debug_compression_path_info; @@ -2484,7 +2485,10 @@ SELECT compress_chunk(c) FROM show_chunks('t6367') c; _timescaledb_internal._hyper_1_2_chunk (2 rows) -DROP INDEX _timescaledb_internal._compressed_hypertable_2_source_id_label__ts_meta_sequence__idx; +SELECT format('%I.%I', schema_name, table_name) AS "CHUNK1" FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2 ORDER BY id LIMIT 1 \gset +SELECT format('%I.%I', schema_name, table_name) AS "CHUNK2" FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2 ORDER BY id LIMIT 1 OFFSET 1 \gset +DROP INDEX _timescaledb_internal.compress_hyper_2_3_chunk_source_id_label__ts_meta_sequence__idx; +DROP INDEX _timescaledb_internal.compress_hyper_2_4_chunk_source_id_label__ts_meta_sequence__idx; -- testcase with no index, should use seq scan set timescaledb.debug_compression_path_info to on; BEGIN; @@ -2506,7 +2510,8 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; ROLLBACK; -- test case with an index which has only one -- of the segmentby filters -CREATE INDEX source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (source_id); +CREATE INDEX source_id_idx1 ON :CHUNK1 (source_id); +CREATE INDEX source_id_idx2 ON :CHUNK2 (source_id); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; count @@ -2515,9 +2520,9 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; (1 row) UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label = '1'; -INFO: Index "compress_hyper_2_3_chunk_source_id_idx" is used for scan. +INFO: Index "source_id_idx1" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 2. -INFO: Index "compress_hyper_2_4_chunk_source_id_idx" is used for scan. +INFO: Index "source_id_idx2" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 2. SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; count @@ -2535,9 +2540,9 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NULL; (1 row) UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label IS NULL; -INFO: Index "compress_hyper_2_3_chunk_source_id_idx" is used for scan. +INFO: Index "source_id_idx1" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 3. -INFO: Index "compress_hyper_2_4_chunk_source_id_idx" is used for scan. +INFO: Index "source_id_idx2" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 3. SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NULL; count @@ -2554,9 +2559,9 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NOT NULL; (1 row) UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label IS NOT NULL; -INFO: Index "compress_hyper_2_3_chunk_source_id_idx" is used for scan. +INFO: Index "source_id_idx1" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 0. -INFO: Index "compress_hyper_2_4_chunk_source_id_idx" is used for scan. +INFO: Index "source_id_idx2" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 0. SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NOT NULL; count @@ -2565,9 +2570,10 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NOT NULL; (1 row) ROLLBACK; -DROP INDEX _timescaledb_internal.source_id_idx; +DROP INDEX _timescaledb_internal.source_id_idx1; +DROP INDEX _timescaledb_internal.source_id_idx2; -- test case with an index which has multiple same column -CREATE INDEX source_id_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (source_id, source_id); +CREATE INDEX source_id_source_id_idx ON :CHUNK1 (source_id, source_id); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; count @@ -2576,10 +2582,9 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; (1 row) UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label = '1'; -INFO: Index "compress_hyper_2_3_chunk_source_id_source_id_idx" is used for scan. -INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 2. -INFO: Index "compress_hyper_2_4_chunk_source_id_source_id_idx" is used for scan. +INFO: Index "source_id_source_id_idx" is used for scan. INFO: Number of compressed rows fetched from index: 3. Number of compressed rows filtered by heap filters: 2. +INFO: Number of compressed rows fetched from table scan: 1. Number of compressed rows filtered: 0. SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; count ------- @@ -2590,7 +2595,7 @@ ROLLBACK; DROP INDEX _timescaledb_internal.source_id_source_id_idx; -- test using a non-btree index -- fallback to heap scan -CREATE INDEX brin_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 USING brin (source_id); +CREATE INDEX brin_source_id_idx ON :CHUNK1 USING brin (source_id); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; count @@ -2611,7 +2616,7 @@ ROLLBACK; DROP INDEX _timescaledb_internal.brin_source_id_idx; -- test using an expression index -- should fallback to heap scans -CREATE INDEX expr_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (upper(source_id)); +CREATE INDEX expr_source_id_idx ON :CHUNK1 (upper(source_id)); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; count @@ -2632,7 +2637,7 @@ ROLLBACK; DROP INDEX _timescaledb_internal.expr_source_id_idx; -- test using a partial index -- should fallback to heap scans -CREATE INDEX partial_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (source_id) +CREATE INDEX partial_source_id_idx ON :CHUNK1 (source_id) WHERE _ts_meta_min_1 > '1990-01-01'::timestamptz; BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; diff --git a/tsl/test/expected/exp_cagg_origin.out b/tsl/test/expected/exp_cagg_origin.out index c7f2ab6b9be..84cc21a1b83 100644 --- a/tsl/test/expected/exp_cagg_origin.out +++ b/tsl/test/expected/exp_cagg_origin.out @@ -461,7 +461,6 @@ ORDER BY month, city; -- Clean up DROP TABLE conditions CASCADE; -NOTICE: drop cascades to 66 other objects NOTICE: drop cascades to 7 other objects NOTICE: drop cascades to 3 other objects NOTICE: drop cascades to 3 other objects @@ -717,7 +716,6 @@ SELECT add_continuous_aggregate_policy('conditions_summary_timestamp', -- Clean up DROP TABLE conditions_timestamp CASCADE; -NOTICE: drop cascades to 2 other objects NOTICE: drop cascades to 3 other objects NOTICE: drop cascades to table _timescaledb_internal._hyper_11_175_chunk -- Make sure CAGGs with custom origin work for timestamptz type @@ -933,5 +931,4 @@ SELECT add_continuous_aggregate_policy('conditions_summary_timestamptz', -- Clean up DROP TABLE conditions_timestamptz CASCADE; NOTICE: drop cascades to 3 other objects -NOTICE: drop cascades to 3 other objects NOTICE: drop cascades to table _timescaledb_internal._hyper_15_181_chunk diff --git a/tsl/test/expected/merge_append_partially_compressed-13.out b/tsl/test/expected/merge_append_partially_compressed-13.out index 81fecb77aa1..4eaeecf4c02 100644 --- a/tsl/test/expected/merge_append_partially_compressed-13.out +++ b/tsl/test/expected/merge_append_partially_compressed-13.out @@ -182,8 +182,8 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -194,7 +194,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -207,7 +207,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -219,7 +219,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -228,8 +228,8 @@ generate_series(1,3) device; (41 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time, device DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time", ht_metrics_compressed.device DESC @@ -240,7 +240,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device DESC @@ -253,7 +253,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC @@ -265,7 +265,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC @@ -275,8 +275,8 @@ generate_series(1,3) device; -- index scan, no sort on top :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; -- index scan, no resorting required - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -284,7 +284,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -296,7 +296,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -306,7 +306,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -321,14 +321,14 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC LIMIT 1; -- this uses the index and does not do sort on top - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC @@ -338,7 +338,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 36 -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk."time" DESC @@ -348,7 +348,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 38 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -365,8 +365,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC LIMIT 1; -- this also uses the index and does not do sort on top - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" @@ -374,7 +374,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_1_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" @@ -386,7 +386,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_2_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" @@ -396,7 +396,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_3_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time" @@ -447,8 +447,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC (30 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY device, time DESC LIMIT 1; -- with pushdown - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -457,7 +457,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_4_chunk.device, compress_hyper_2_4_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -469,7 +469,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_5_chunk.device, compress_hyper_2_5_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device, _hyper_1_2_chunk."time" DESC @@ -481,7 +481,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_6_chunk.device, compress_hyper_2_6_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk.device, _hyper_1_3_chunk."time" DESC @@ -834,7 +834,7 @@ SELECT * FROM test1 ORDER BY x1, x2, x5, time DESC, x3 ASC, x4 ASC LIMIT 10; -- -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2, _hyper_3_7_chunk.x5, _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Index Scan using compress_hyper_4_8_chunk__compressed_hypertable_4_x1_x2_x5__ts_ on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_4_8_chunk_x1_x2_x5__ts_meta_sequence_num_idx on compress_hyper_4_8_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2, _hyper_3_7_chunk.x5, _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 Sort Method: quicksort diff --git a/tsl/test/expected/merge_append_partially_compressed-14.out b/tsl/test/expected/merge_append_partially_compressed-14.out index 7142a997e94..77381c54acd 100644 --- a/tsl/test/expected/merge_append_partially_compressed-14.out +++ b/tsl/test/expected/merge_append_partially_compressed-14.out @@ -182,8 +182,8 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -194,7 +194,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -207,7 +207,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -219,7 +219,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -228,8 +228,8 @@ generate_series(1,3) device; (41 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time, device DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time", ht_metrics_compressed.device DESC @@ -240,7 +240,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device DESC @@ -253,7 +253,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC @@ -265,7 +265,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC @@ -275,8 +275,8 @@ generate_series(1,3) device; -- index scan, no sort on top :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; -- index scan, no resorting required - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -284,7 +284,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -296,7 +296,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -306,7 +306,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -321,14 +321,14 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC LIMIT 1; -- this uses the index and does not do sort on top - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC @@ -338,7 +338,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 36 -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk."time" DESC @@ -348,7 +348,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 38 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -365,8 +365,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC LIMIT 1; -- this also uses the index and does not do sort on top - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" @@ -374,7 +374,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_1_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" @@ -386,7 +386,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_2_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" @@ -396,7 +396,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_3_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time" @@ -447,8 +447,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC (30 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY device, time DESC LIMIT 1; -- with pushdown - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -457,7 +457,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_4_chunk.device, compress_hyper_2_4_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -469,7 +469,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_5_chunk.device, compress_hyper_2_5_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device, _hyper_1_2_chunk."time" DESC @@ -481,7 +481,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_6_chunk.device, compress_hyper_2_6_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk.device, _hyper_1_3_chunk."time" DESC diff --git a/tsl/test/expected/merge_append_partially_compressed-15.out b/tsl/test/expected/merge_append_partially_compressed-15.out index 4b5b9c1452d..ee9f92d7eeb 100644 --- a/tsl/test/expected/merge_append_partially_compressed-15.out +++ b/tsl/test/expected/merge_append_partially_compressed-15.out @@ -188,8 +188,8 @@ generate_series(1,3) device; (35 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -200,7 +200,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -213,7 +213,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -225,7 +225,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -234,8 +234,8 @@ generate_series(1,3) device; (41 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time, device DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time", ht_metrics_compressed.device DESC @@ -246,7 +246,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device DESC @@ -259,7 +259,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC @@ -271,7 +271,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC @@ -281,8 +281,8 @@ generate_series(1,3) device; -- index scan, no sort on top :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; -- index scan, no resorting required - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -290,7 +290,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -302,7 +302,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -312,7 +312,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -327,14 +327,14 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC LIMIT 1; -- this uses the index and does not do sort on top - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC @@ -344,7 +344,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 36 -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk."time" DESC @@ -354,7 +354,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 38 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -371,8 +371,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC LIMIT 1; -- this also uses the index and does not do sort on top - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" @@ -380,7 +380,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_1_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" @@ -392,7 +392,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_2_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" @@ -402,7 +402,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_3_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time" @@ -453,8 +453,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC (30 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY device, time DESC LIMIT 1; -- with pushdown - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -463,7 +463,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_4_chunk.device, compress_hyper_2_4_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -475,7 +475,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_5_chunk.device, compress_hyper_2_5_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device, _hyper_1_2_chunk."time" DESC @@ -487,7 +487,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_6_chunk.device, compress_hyper_2_6_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk.device, _hyper_1_3_chunk."time" DESC diff --git a/tsl/test/expected/merge_append_partially_compressed-16.out b/tsl/test/expected/merge_append_partially_compressed-16.out index 4b5b9c1452d..ee9f92d7eeb 100644 --- a/tsl/test/expected/merge_append_partially_compressed-16.out +++ b/tsl/test/expected/merge_append_partially_compressed-16.out @@ -188,8 +188,8 @@ generate_series(1,3) device; (35 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -200,7 +200,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -213,7 +213,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -225,7 +225,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -234,8 +234,8 @@ generate_series(1,3) device; (41 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time, device DESC LIMIT 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time", ht_metrics_compressed.device DESC @@ -246,7 +246,7 @@ generate_series(1,3) device; Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device DESC @@ -259,7 +259,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC @@ -271,7 +271,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = ANY ('{1,2,3}'::integer[])) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC @@ -281,8 +281,8 @@ generate_series(1,3) device; -- index scan, no sort on top :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; -- index scan, no resorting required - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" DESC @@ -290,7 +290,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_3_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -302,7 +302,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_2_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC @@ -312,7 +312,7 @@ generate_series(1,3) device; Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (never executed) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC @@ -327,14 +327,14 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC LIMIT 1; -- this uses the index and does not do sort on top - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" DESC @@ -344,7 +344,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 36 -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk."time" DESC @@ -354,7 +354,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time DESC LIMIT 1; Rows Removed by Filter: 38 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC @@ -371,8 +371,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC (1 row) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC LIMIT 1; -- this also uses the index and does not do sort on top - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) Order: ht_metrics_compressed."time" @@ -380,7 +380,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_1_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1 loops=1) Filter: (device = 3) - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) Index Cond: (device = 3) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" @@ -392,7 +392,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_2_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (never executed) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" @@ -402,7 +402,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY device, time DESC Sort Key: _hyper_1_3_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (device = 3) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) Index Cond: (device = 3) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time" @@ -453,8 +453,8 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC (30 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY device, time DESC LIMIT 1; -- with pushdown - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -463,7 +463,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_4_chunk.device, compress_hyper_2_4_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_4_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" DESC @@ -475,7 +475,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_5_chunk.device, compress_hyper_2_5_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device, _hyper_1_2_chunk."time" DESC @@ -487,7 +487,7 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_6_chunk.device, compress_hyper_2_6_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device__ts_me on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) Index Cond: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk.device, _hyper_1_3_chunk."time" DESC diff --git a/tsl/test/expected/move.out b/tsl/test/expected/move.out index 426c4b12295..d6944b4a247 100644 --- a/tsl/test/expected/move.out +++ b/tsl/test/expected/move.out @@ -480,8 +480,8 @@ SELECT * FROM test.show_indexesp('_timescaledb_internal._hyper%_chunk'); (4 rows) SELECT * FROM test.show_indexesp('_timescaledb_internal.compress_hyper%_chunk'); - Table | Index | Columns | Expr | Unique | Primary | Exclusion | Tablespace -------------------------------------------------+---------------------------------------------------------------------------------------+----------------------------------+------+--------+---------+-----------+------------- - _timescaledb_internal.compress_hyper_2_3_chunk | _timescaledb_internal.compress_hyper_2_3_chunk__compressed_hypertable_2_location__ts_ | {location,_ts_meta_sequence_num} | | f | f | f | tablespace1 + Table | Index | Columns | Expr | Unique | Primary | Exclusion | Tablespace +------------------------------------------------+-----------------------------------------------------------------------------------+----------------------------------+------+--------+---------+-----------+------------- + _timescaledb_internal.compress_hyper_2_3_chunk | _timescaledb_internal.compress_hyper_2_3_chunk_location__ts_meta_sequence_num_idx | {location,_ts_meta_sequence_num} | | f | f | f | tablespace1 (1 row) diff --git a/tsl/test/expected/plan_skip_scan-13.out b/tsl/test/expected/plan_skip_scan-13.out index 3eebe728eaa..860bd9c4085 100644 --- a/tsl/test/expected/plan_skip_scan-13.out +++ b/tsl/test/expected/plan_skip_scan-13.out @@ -3835,13 +3835,13 @@ SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); (1 row) :PREFIX SELECT DISTINCT ON (dev) dev, dev_name FROM :TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=11 loops=1) -> Merge Append (actual rows=2538 loops=1) Sort Key: _hyper_1_1_chunk.dev -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2505 loops=1) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_dev__ts_meta_ on compress_hyper_2_5_chunk (actual rows=11 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_dev__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_2_chunk (actual rows=11 loops=1) -> Index Scan using _hyper_1_2_chunk_skip_scan_ht_dev_idx1 on _hyper_1_2_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_3_chunk (actual rows=11 loops=1) diff --git a/tsl/test/expected/plan_skip_scan-14.out b/tsl/test/expected/plan_skip_scan-14.out index fc6f1ae468d..83c4c374655 100644 --- a/tsl/test/expected/plan_skip_scan-14.out +++ b/tsl/test/expected/plan_skip_scan-14.out @@ -3833,13 +3833,13 @@ SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); (1 row) :PREFIX SELECT DISTINCT ON (dev) dev, dev_name FROM :TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=11 loops=1) -> Merge Append (actual rows=2538 loops=1) Sort Key: _hyper_1_1_chunk.dev -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2505 loops=1) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_dev__ts_meta_ on compress_hyper_2_5_chunk (actual rows=11 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_dev__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_2_chunk (actual rows=11 loops=1) -> Index Scan using _hyper_1_2_chunk_skip_scan_ht_dev_idx1 on _hyper_1_2_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_3_chunk (actual rows=11 loops=1) diff --git a/tsl/test/expected/plan_skip_scan-15.out b/tsl/test/expected/plan_skip_scan-15.out index fc6f1ae468d..83c4c374655 100644 --- a/tsl/test/expected/plan_skip_scan-15.out +++ b/tsl/test/expected/plan_skip_scan-15.out @@ -3833,13 +3833,13 @@ SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); (1 row) :PREFIX SELECT DISTINCT ON (dev) dev, dev_name FROM :TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=11 loops=1) -> Merge Append (actual rows=2538 loops=1) Sort Key: _hyper_1_1_chunk.dev -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2505 loops=1) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_dev__ts_meta_ on compress_hyper_2_5_chunk (actual rows=11 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_dev__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_2_chunk (actual rows=11 loops=1) -> Index Scan using _hyper_1_2_chunk_skip_scan_ht_dev_idx1 on _hyper_1_2_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_3_chunk (actual rows=11 loops=1) diff --git a/tsl/test/expected/plan_skip_scan-16.out b/tsl/test/expected/plan_skip_scan-16.out index 14a2112598b..9891b7bd08b 100644 --- a/tsl/test/expected/plan_skip_scan-16.out +++ b/tsl/test/expected/plan_skip_scan-16.out @@ -3828,13 +3828,13 @@ SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); (1 row) :PREFIX SELECT DISTINCT ON (dev) dev, dev_name FROM :TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=11 loops=1) -> Merge Append (actual rows=2538 loops=1) Sort Key: _hyper_1_1_chunk.dev -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2505 loops=1) - -> Index Scan using compress_hyper_2_5_chunk__compressed_hypertable_2_dev__ts_meta_ on compress_hyper_2_5_chunk (actual rows=11 loops=1) + -> Index Scan using compress_hyper_2_5_chunk_dev__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_2_chunk (actual rows=11 loops=1) -> Index Scan using _hyper_1_2_chunk_skip_scan_ht_dev_idx1 on _hyper_1_2_chunk (actual rows=11 loops=1) -> Custom Scan (SkipScan) on _hyper_1_3_chunk (actual rows=11 loops=1) diff --git a/tsl/test/expected/recompress_chunk_segmentwise.out b/tsl/test/expected/recompress_chunk_segmentwise.out index f84827fbe87..0b1327d004a 100644 --- a/tsl/test/expected/recompress_chunk_segmentwise.out +++ b/tsl/test/expected/recompress_chunk_segmentwise.out @@ -324,12 +324,12 @@ SELECT compress_chunk(:'chunk_to_compress_prep'); -- the output of the prepared INSERT INTO mytab_prep VALUES ('2023-01-01'::timestamptz, 2, 3, 2); -- plan should be invalidated to return results from the uncompressed chunk also EXPLAIN (COSTS OFF) EXECUTE p1; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_9_10_chunk.a, _hyper_9_10_chunk.c, _hyper_9_10_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_9_10_chunk - -> Index Scan using compress_hyper_10_11_chunk__compressed_hypertable_10_a_c__ts_me on compress_hyper_10_11_chunk + -> Index Scan using compress_hyper_10_11_chunk_a_c__ts_meta_sequence_num_idx on compress_hyper_10_11_chunk -> Sort Sort Key: _hyper_9_10_chunk.a, _hyper_9_10_chunk.c, _hyper_9_10_chunk."time" DESC -> Seq Scan on _hyper_9_10_chunk @@ -346,10 +346,10 @@ EXECUTE p1; -- check plan again after recompression CALL recompress_chunk(:'chunk_to_compress_prep'); EXPLAIN (COSTS OFF) EXECUTE p1; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- Custom Scan (DecompressChunk) on _hyper_9_10_chunk - -> Index Scan using compress_hyper_10_11_chunk__compressed_hypertable_10_a_c__ts_me on compress_hyper_10_11_chunk + -> Index Scan using compress_hyper_10_11_chunk_a_c__ts_meta_sequence_num_idx on compress_hyper_10_11_chunk (2 rows) EXECUTE p1; @@ -403,11 +403,11 @@ CALL recompress_chunk(:'chunk_to_compress_mytab'); -- make sure we are hitting the index and that the index contains the tuples SET enable_seqscan TO off; EXPLAIN (COSTS OFF) SELECT count(*) FROM mytab where a = 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- Aggregate -> Custom Scan (DecompressChunk) on _hyper_11_12_chunk - -> Index Scan using compress_hyper_12_13_chunk__compressed_hypertable_12_a_c__ts_me on compress_hyper_12_13_chunk + -> Index Scan using compress_hyper_12_13_chunk_a_c__ts_meta_sequence_num_idx on compress_hyper_12_13_chunk Index Cond: (a = 2) (4 rows) diff --git a/tsl/test/expected/transparent_decompression-13.out b/tsl/test/expected/transparent_decompression-13.out index e017a7a07ee..6737ae92d51 100644 --- a/tsl/test/expected/transparent_decompression-13.out +++ b/tsl/test/expected/transparent_decompression-13.out @@ -190,12 +190,6 @@ FROM _timescaledb_catalog.hypertable ht -- Index created using query saved in variable used because there was -- no standard way to create an index on a compressed table. -- Once a standard way exists, modify this test to use that method. -CREATE INDEX c_index ON :METRICS_COMPRESSED (device_id); -CREATE INDEX c_space_index ON :METRICS_SPACE_COMPRESSED (device_id); -CREATE INDEX c_index_2 ON :METRICS_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX c_space_index_2 ON :METRICS_SPACE_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX ON :METRICS_COMPRESSED (device_id_peer); -CREATE INDEX ON :METRICS_SPACE_COMPRESSED (device_id_peer); \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER CREATE INDEX ON metrics_space (device_id, device_id_peer, v0, v1 DESC, time); CREATE INDEX ON metrics_space (device_id, device_id_peer DESC, v0, v1 DESC, time); @@ -265,17 +259,16 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) Order: metrics."time" -> Sort (actual rows=360 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -283,10 +276,9 @@ ORDER BY time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(17 rows) -- test expressions :PREFIX @@ -300,31 +292,30 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=720 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- + Incremental Sort (actual rows=2736 loops=1) + Sort Key: metrics."time", metrics.device_id + Presorted Key: metrics."time" + Full-sort Groups: 86 Sort Method: quicksort + -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Order: metrics."time" + -> Sort (actual rows=720 loops=1) + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 1512 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(22 rows) + -> Sort (actual rows=1008 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(21 rows) -- test empty targetlist :PREFIX @@ -345,21 +336,19 @@ FROM :TEST_TABLE; SELECT * FROM :TEST_TABLE WHERE device_id < 0; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) Rows Removed by Filter: 2520 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(10 rows) -- test targetlist not referencing columns :PREFIX @@ -382,24 +371,22 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test order not present in targetlist :PREFIX @@ -407,45 +394,41 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -786,18 +769,15 @@ WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 1795 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_5_15_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) -(9 rows) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(6 rows) :PREFIX SELECT * @@ -1357,7 +1337,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1392,7 +1372,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1425,7 +1405,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1457,7 +1437,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1491,7 +1471,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1793,8 +1773,8 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (actual rows=1368 loops=1) Merge Cond: (metrics."time" = metrics_1."time") -> Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) @@ -1803,9 +1783,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -1813,9 +1792,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1823,9 +1801,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2016 @@ -1833,10 +1810,9 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 -(41 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) +(37 rows) -- test prepared statement PREPARE prep AS @@ -1844,25 +1820,23 @@ SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; :PREFIX EXECUTE prep; - QUERY PLAN ------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(16 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(14 rows) EXECUTE prep; count @@ -1924,7 +1898,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1938,7 +1912,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1961,7 +1935,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1975,7 +1949,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1998,7 +1972,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=504 loops=1) @@ -2012,7 +1986,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2023,16 +1997,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2040,18 +2013,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -2059,10 +2031,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -2072,11 +2043,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -2084,26 +2054,24 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count - Heap Fetches: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 2520 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count - Heap Fetches: 5 -(17 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 +(15 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -2115,28 +2083,33 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=0 loops=1) - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Merge Append (actual rows=0 loops=1) Sort Key: _hyper_1_1_chunk."time" - Sort Method: quicksort - -> Append (actual rows=0 loops=1) + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 - Filter: (_hyper_1_2_chunk.device_id_peer = 1) - Rows Removed by Filter: 2520 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 + Filter: (_hyper_1_2_chunk.device_id_peer = 1) + Rows Removed by Filter: 2520 + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(21 rows) +(26 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2149,7 +2122,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) @@ -2159,7 +2132,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) (17 rows) @@ -2178,10 +2151,9 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id_peer = 1) @@ -2189,11 +2161,10 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) +(17 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2218,7 +2189,7 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=2) @@ -2228,7 +2199,7 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) (27 rows) @@ -2245,10 +2216,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2256,11 +2226,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2285,7 +2254,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=2) @@ -2295,7 +2264,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2310,25 +2279,30 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join + Nested Loop Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Unique + Output: "*VALUES*".column1 + -> Sort + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - -> Hash - Output: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 -(18 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(23 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2342,10 +2316,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2353,11 +2326,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2381,7 +2353,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=2) @@ -2391,7 +2363,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2440,11 +2412,10 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: ((m1."time" = m2."time") AND (m1.device_id = m2.device_id)) + -> Nested Loop (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2459,22 +2430,21 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Materialize (actual rows=10 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=10 loops=1) - Order: m2."time", m2.device_id - -> Sort (actual rows=10 loops=1) - Sort Key: m2_1."time", m2_1.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) - -> Sort (never executed) - Sort Key: m2_2."time", m2_2.device_id - -> Seq Scan on _hyper_1_2_chunk m2_2 (never executed) - -> Sort (never executed) - Sort Key: m2_3."time", m2_3.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) -(32 rows) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: (m1."time" = "time") + Rows Removed by Filter: 323 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) + Index Cond: (device_id = m1.device_id) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) + Index Cond: ("time" = m1."time") + Filter: (m1.device_id = device_id) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) + Filter: (m1."time" = "time") + Rows Removed by Filter: 504 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) + Index Cond: (device_id = m1.device_id) +(30 rows) :PREFIX SELECT * @@ -2486,12 +2456,13 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: (m1."time" = m3_1."time") + -> Nested Loop (actual rows=10 loops=1) -> Nested Loop (actual rows=10 loops=1) + Join Filter: (m1."time" = m3_1."time") + Rows Removed by Join Filter: 12304 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2506,41 +2477,32 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Append (actual rows=1 loops=10) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) - Filter: (m1."time" = "time") - Rows Removed by Filter: 323 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) - Index Cond: (device_id = m1.device_id) - -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) - Index Cond: ("time" = m1."time") - Filter: (m1.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) - Filter: (m1."time" = "time") - Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) - Index Cond: (device_id = m1.device_id) - -> Materialize (actual rows=10 loops=1) - -> Merge Append (actual rows=3 loops=1) - Sort Key: m3_1."time" - -> Sort (actual rows=3 loops=1) - Sort Key: m3_1."time" - Sort Method: quicksort + -> Materialize (actual rows=1231 loops=10) + -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m3_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 2 - -> Sort (actual rows=1 loops=1) - Sort Key: m3_3."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) + Index Cond: (device_id = 3) + -> Seq Scan on _hyper_1_2_chunk m3_2 (actual rows=504 loops=1) + Filter: (device_id = 3) + Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 4 -(52 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) + Index Cond: (device_id = 3) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: (m1."time" = "time") + Rows Removed by Filter: 323 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) + Index Cond: (device_id = m1.device_id) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) + Index Cond: ("time" = m1."time") + Filter: (m1.device_id = device_id) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) + Filter: (m1."time" = "time") + Rows Removed by Filter: 504 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) + Index Cond: (device_id = m1.device_id) +(44 rows) :PREFIX SELECT * @@ -2700,8 +2662,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) -> Incremental Sort (actual rows=100 loops=1) Sort Key: m1."time", m1.device_id, m2."time", m2.device_id @@ -2732,17 +2694,16 @@ LIMIT 100; Sort Key: m2_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_3."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) - Filter: (device_id = 2) -(40 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Index Cond: (device_id = 2) +(39 rows) :PREFIX SELECT * @@ -2984,8 +2945,8 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': AND device_id = $1 LIMIT 1) m1 ON TRUE; :PREFIX EXECUTE param_prep (1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -2994,21 +2955,23 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -(18 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) +(20 rows) :PREFIX EXECUTE param_prep (2); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -3017,9 +2980,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 2) @@ -3027,9 +2990,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) (21 rows) EXECUTE param_prep (1); @@ -3188,29 +3151,29 @@ FROM metrics, WHERE metrics.time > metrics_space.time AND metrics.device_id = metrics_space.device_id AND metrics.time < metrics_space.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (actual rows=0 loops=1) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) -> Append (actual rows=0 loops=6840) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=6840) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) @@ -3218,7 +3181,7 @@ WHERE metrics.time > metrics_space.time -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -5349,14 +5312,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5509,14 +5472,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5558,14 +5521,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -6236,7 +6199,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6249,7 +6212,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6272,7 +6235,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6285,7 +6248,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6308,7 +6271,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk test_table_2 (actual rows=504 loops=1) @@ -6321,7 +6284,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6332,16 +6295,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) @@ -6349,18 +6311,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -6368,10 +6329,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6381,11 +6341,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -6393,28 +6352,25 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 504 @@ -6427,19 +6383,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 504 -(44 rows) +(39 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -6459,19 +6413,19 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id, _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.v0, _hyper_2_5_chunk.v1, _hyper_2_5_chunk.v2, _hyper_2_5_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id, _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.v0, _hyper_2_6_chunk.v1, _hyper_2_6_chunk.v2, _hyper_2_6_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6486,13 +6440,13 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6511,19 +6465,19 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6541,13 +6495,13 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6774,17 +6728,17 @@ WHERE device_id IN ( -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id = "*VALUES*".column1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk @@ -6798,12 +6752,12 @@ WHERE device_id IN ( Index Cond: (_hyper_2_9_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id = "*VALUES*".column1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk @@ -8066,29 +8020,29 @@ FROM metrics, WHERE metrics.time > metrics_space.time AND metrics.device_id = metrics_space.device_id AND metrics.time < metrics_space.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (actual rows=0 loops=1) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) -> Append (actual rows=0 loops=6840) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=6840) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) @@ -8096,7 +8050,7 @@ WHERE metrics.time > metrics_space.time -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -8169,73 +8123,49 @@ $$; -- should have ordered DecompressChunk path because segmentby columns have equality constraints :PREFIX SELECT * FROM metrics_ordered WHERE device_id = 1 AND device_id_peer = 3 ORDER BY time DESC LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_ordered (actual rows=0 loops=1) Order: metrics_ordered."time" DESC -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_31_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_30_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_29_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(24 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) +(12 rows) :PREFIX SELECT DISTINCT ON (d.device_id) * FROM metrics_ordered d INNER JOIN LATERAL (SELECT * FROM metrics_ordered m WHERE m.device_id=d.device_id AND m.device_id_peer = 3 ORDER BY time DESC LIMIT 1 ) m ON true; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) -> Merge Append (actual rows=6840 loops=1) Sort Key: d_1.device_id -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=1800 loops=1) - -> Index Scan using compress_hyper_12_29_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_29_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_30_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_30_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_31_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_31_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=5 loops=1) -> Limit (actual rows=0 loops=6840) -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=6840) Order: m."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_31_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_30_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_29_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(35 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) +(23 rows) \ir include/transparent_decompression_systemcolumns.sql -- This file and its contents are licensed under the Timescale License. @@ -9863,8 +9793,8 @@ SET enable_seqscan TO false; -- should order compressed chunks using index -- (we only EXPLAIN here b/c the resulting order is too inconsistent) EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_1_2_chunk.device_id -> Sort @@ -9873,13 +9803,13 @@ EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY dev Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (10 rows) EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_2_7_chunk.device_id -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk @@ -9890,11 +9820,11 @@ EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 2b6befaf159..3f3efeea933 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -190,12 +190,6 @@ FROM _timescaledb_catalog.hypertable ht -- Index created using query saved in variable used because there was -- no standard way to create an index on a compressed table. -- Once a standard way exists, modify this test to use that method. -CREATE INDEX c_index ON :METRICS_COMPRESSED (device_id); -CREATE INDEX c_space_index ON :METRICS_SPACE_COMPRESSED (device_id); -CREATE INDEX c_index_2 ON :METRICS_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX c_space_index_2 ON :METRICS_SPACE_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX ON :METRICS_COMPRESSED (device_id_peer); -CREATE INDEX ON :METRICS_SPACE_COMPRESSED (device_id_peer); \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER CREATE INDEX ON metrics_space (device_id, device_id_peer, v0, v1 DESC, time); CREATE INDEX ON metrics_space (device_id, device_id_peer DESC, v0, v1 DESC, time); @@ -265,17 +259,16 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) Order: metrics."time" -> Sort (actual rows=360 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -283,10 +276,9 @@ ORDER BY time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(17 rows) -- test expressions :PREFIX @@ -300,31 +292,30 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=720 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- + Incremental Sort (actual rows=2736 loops=1) + Sort Key: metrics."time", metrics.device_id + Presorted Key: metrics."time" + Full-sort Groups: 86 Sort Method: quicksort + -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Order: metrics."time" + -> Sort (actual rows=720 loops=1) + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 1512 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(22 rows) + -> Sort (actual rows=1008 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(21 rows) -- test empty targetlist :PREFIX @@ -345,21 +336,19 @@ FROM :TEST_TABLE; SELECT * FROM :TEST_TABLE WHERE device_id < 0; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) Rows Removed by Filter: 2520 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(10 rows) -- test targetlist not referencing columns :PREFIX @@ -382,24 +371,22 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test order not present in targetlist :PREFIX @@ -407,45 +394,41 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -786,18 +769,15 @@ WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 1795 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_5_15_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) -(9 rows) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(6 rows) :PREFIX SELECT * @@ -1357,7 +1337,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1392,7 +1372,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1425,7 +1405,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1457,7 +1437,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1491,7 +1471,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1793,8 +1773,8 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (actual rows=1368 loops=1) Merge Cond: (metrics."time" = metrics_1."time") -> Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) @@ -1803,9 +1783,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -1813,9 +1792,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1823,9 +1801,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2016 @@ -1833,10 +1810,9 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 -(41 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) +(37 rows) -- test prepared statement PREPARE prep AS @@ -1844,25 +1820,23 @@ SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; :PREFIX EXECUTE prep; - QUERY PLAN ------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(16 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(14 rows) EXECUTE prep; count @@ -1924,7 +1898,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1938,7 +1912,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1961,7 +1935,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1975,7 +1949,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1998,7 +1972,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=504 loops=1) @@ -2012,7 +1986,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2023,16 +1997,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2040,18 +2013,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -2059,10 +2031,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -2072,11 +2043,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -2084,26 +2054,24 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count - Heap Fetches: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 2520 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count - Heap Fetches: 5 -(17 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 +(15 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -2115,28 +2083,33 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=0 loops=1) - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Merge Append (actual rows=0 loops=1) Sort Key: _hyper_1_1_chunk."time" - Sort Method: quicksort - -> Append (actual rows=0 loops=1) + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 - Filter: (_hyper_1_2_chunk.device_id_peer = 1) - Rows Removed by Filter: 2520 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 + Filter: (_hyper_1_2_chunk.device_id_peer = 1) + Rows Removed by Filter: 2520 + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(21 rows) +(26 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2149,7 +2122,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) @@ -2159,7 +2132,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) (17 rows) @@ -2178,10 +2151,9 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id_peer = 1) @@ -2189,11 +2161,10 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) +(17 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2218,7 +2189,7 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=2) @@ -2228,7 +2199,7 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) (27 rows) @@ -2245,10 +2216,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2256,11 +2226,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2285,7 +2254,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=2) @@ -2295,7 +2264,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2310,25 +2279,30 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join + Nested Loop Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Unique + Output: "*VALUES*".column1 + -> Sort + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - -> Hash - Output: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 -(18 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(23 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2342,10 +2316,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2353,11 +2326,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2381,7 +2353,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=2) @@ -2391,7 +2363,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2440,11 +2412,10 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: ((m1."time" = m2."time") AND (m1.device_id = m2.device_id)) + -> Nested Loop (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2459,22 +2430,21 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Materialize (actual rows=10 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=10 loops=1) - Order: m2."time", m2.device_id - -> Sort (actual rows=10 loops=1) - Sort Key: m2_1."time", m2_1.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) - -> Sort (never executed) - Sort Key: m2_2."time", m2_2.device_id - -> Seq Scan on _hyper_1_2_chunk m2_2 (never executed) - -> Sort (never executed) - Sort Key: m2_3."time", m2_3.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) -(32 rows) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: (m1."time" = "time") + Rows Removed by Filter: 323 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) + Index Cond: (device_id = m1.device_id) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) + Index Cond: ("time" = m1."time") + Filter: (m1.device_id = device_id) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) + Filter: (m1."time" = "time") + Rows Removed by Filter: 504 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) + Index Cond: (device_id = m1.device_id) +(30 rows) :PREFIX SELECT * @@ -2486,12 +2456,13 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: (m1."time" = m3_1."time") + -> Nested Loop (actual rows=10 loops=1) -> Nested Loop (actual rows=10 loops=1) + Join Filter: (m1."time" = m3_1."time") + Rows Removed by Join Filter: 12304 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2506,41 +2477,32 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Append (actual rows=1 loops=10) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) - Filter: (m1."time" = "time") - Rows Removed by Filter: 323 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) - Index Cond: (device_id = m1.device_id) - -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) - Index Cond: ("time" = m1."time") - Filter: (m1.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) - Filter: (m1."time" = "time") - Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) - Index Cond: (device_id = m1.device_id) - -> Materialize (actual rows=10 loops=1) - -> Merge Append (actual rows=3 loops=1) - Sort Key: m3_1."time" - -> Sort (actual rows=3 loops=1) - Sort Key: m3_1."time" - Sort Method: quicksort + -> Materialize (actual rows=1231 loops=10) + -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m3_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 2 - -> Sort (actual rows=1 loops=1) - Sort Key: m3_3."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) + Index Cond: (device_id = 3) + -> Seq Scan on _hyper_1_2_chunk m3_2 (actual rows=504 loops=1) + Filter: (device_id = 3) + Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 4 -(52 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) + Index Cond: (device_id = 3) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: (m1."time" = "time") + Rows Removed by Filter: 323 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) + Index Cond: (device_id = m1.device_id) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) + Index Cond: ("time" = m1."time") + Filter: (m1.device_id = device_id) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) + Filter: (m1."time" = "time") + Rows Removed by Filter: 504 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) + Index Cond: (device_id = m1.device_id) +(44 rows) :PREFIX SELECT * @@ -2700,8 +2662,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) -> Incremental Sort (actual rows=100 loops=1) Sort Key: m1."time", m1.device_id, m2."time", m2.device_id @@ -2732,17 +2694,16 @@ LIMIT 100; Sort Key: m2_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_3."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) - Filter: (device_id = 2) -(40 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Index Cond: (device_id = 2) +(39 rows) :PREFIX SELECT * @@ -2984,8 +2945,8 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': AND device_id = $1 LIMIT 1) m1 ON TRUE; :PREFIX EXECUTE param_prep (1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -2994,21 +2955,23 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -(18 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) +(20 rows) :PREFIX EXECUTE param_prep (2); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -3017,9 +2980,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 2) @@ -3027,9 +2990,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) (21 rows) EXECUTE param_prep (1); @@ -3188,29 +3151,29 @@ FROM metrics, WHERE metrics.time > metrics_space.time AND metrics.device_id = metrics_space.device_id AND metrics.time < metrics_space.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (actual rows=0 loops=1) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) -> Append (actual rows=0 loops=6840) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=6840) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) @@ -3218,7 +3181,7 @@ WHERE metrics.time > metrics_space.time -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -5349,14 +5312,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5509,14 +5472,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5558,14 +5521,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -6236,7 +6199,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6249,7 +6212,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6272,7 +6235,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6285,7 +6248,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6308,7 +6271,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk test_table_2 (actual rows=504 loops=1) @@ -6321,7 +6284,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6332,16 +6295,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) @@ -6349,18 +6311,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -6368,10 +6329,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6381,11 +6341,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -6393,28 +6352,25 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 504 @@ -6427,19 +6383,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 504 -(44 rows) +(39 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -6460,7 +6414,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6470,7 +6424,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id, _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.v0, _hyper_2_5_chunk.v1, _hyper_2_5_chunk.v2, _hyper_2_5_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6480,7 +6434,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id, _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.v0, _hyper_2_6_chunk.v1, _hyper_2_6_chunk.v2, _hyper_2_6_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6502,7 +6456,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6512,7 +6466,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6532,19 +6486,19 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6562,13 +6516,13 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6795,17 +6749,17 @@ WHERE device_id IN ( -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id = "*VALUES*".column1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk @@ -6819,12 +6773,12 @@ WHERE device_id IN ( Index Cond: (_hyper_2_9_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id = "*VALUES*".column1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk @@ -8054,29 +8008,29 @@ FROM metrics, WHERE metrics.time > metrics_space.time AND metrics.device_id = metrics_space.device_id AND metrics.time < metrics_space.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (actual rows=0 loops=1) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) -> Append (actual rows=0 loops=6840) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=6840) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) @@ -8084,7 +8038,7 @@ WHERE metrics.time > metrics_space.time -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -8157,73 +8111,49 @@ $$; -- should have ordered DecompressChunk path because segmentby columns have equality constraints :PREFIX SELECT * FROM metrics_ordered WHERE device_id = 1 AND device_id_peer = 3 ORDER BY time DESC LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_ordered (actual rows=0 loops=1) Order: metrics_ordered."time" DESC -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_31_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_30_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_29_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(24 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) +(12 rows) :PREFIX SELECT DISTINCT ON (d.device_id) * FROM metrics_ordered d INNER JOIN LATERAL (SELECT * FROM metrics_ordered m WHERE m.device_id=d.device_id AND m.device_id_peer = 3 ORDER BY time DESC LIMIT 1 ) m ON true; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) -> Merge Append (actual rows=6840 loops=1) Sort Key: d_1.device_id -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=1800 loops=1) - -> Index Scan using compress_hyper_12_29_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_29_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_30_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_30_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_31_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_31_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=5 loops=1) -> Limit (actual rows=0 loops=6840) -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=6840) Order: m."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_31_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_30_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_29_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(35 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) +(23 rows) \ir include/transparent_decompression_systemcolumns.sql -- This file and its contents are licensed under the Timescale License. @@ -9851,8 +9781,8 @@ SET enable_seqscan TO false; -- should order compressed chunks using index -- (we only EXPLAIN here b/c the resulting order is too inconsistent) EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_1_2_chunk.device_id -> Sort @@ -9861,13 +9791,13 @@ EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY dev Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (10 rows) EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_2_7_chunk.device_id -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk @@ -9878,11 +9808,11 @@ EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 9da1dcc638e..a5429a0b0e4 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -190,12 +190,6 @@ FROM _timescaledb_catalog.hypertable ht -- Index created using query saved in variable used because there was -- no standard way to create an index on a compressed table. -- Once a standard way exists, modify this test to use that method. -CREATE INDEX c_index ON :METRICS_COMPRESSED (device_id); -CREATE INDEX c_space_index ON :METRICS_SPACE_COMPRESSED (device_id); -CREATE INDEX c_index_2 ON :METRICS_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX c_space_index_2 ON :METRICS_SPACE_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX ON :METRICS_COMPRESSED (device_id_peer); -CREATE INDEX ON :METRICS_SPACE_COMPRESSED (device_id_peer); \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER CREATE INDEX ON metrics_space (device_id, device_id_peer, v0, v1 DESC, time); CREATE INDEX ON metrics_space (device_id, device_id_peer DESC, v0, v1 DESC, time); @@ -265,17 +259,16 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) Order: metrics."time" -> Sort (actual rows=360 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -283,10 +276,9 @@ ORDER BY time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(17 rows) -- test expressions :PREFIX @@ -300,32 +292,31 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Result (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=720 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Incremental Sort (actual rows=2736 loops=1) + Sort Key: metrics."time", metrics.device_id + Presorted Key: metrics."time" + Full-sort Groups: 86 Sort Method: quicksort + -> Result (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Order: metrics."time" + -> Sort (actual rows=720 loops=1) + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 1512 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(23 rows) + -> Sort (actual rows=1008 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(22 rows) -- test empty targetlist :PREFIX @@ -346,21 +337,19 @@ FROM :TEST_TABLE; SELECT * FROM :TEST_TABLE WHERE device_id < 0; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) Rows Removed by Filter: 2520 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(10 rows) -- test targetlist not referencing columns :PREFIX @@ -383,24 +372,22 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test order not present in targetlist :PREFIX @@ -408,45 +395,41 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -787,18 +770,15 @@ WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 1795 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_5_15_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) -(9 rows) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(6 rows) :PREFIX SELECT * @@ -1358,7 +1338,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1393,7 +1373,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1426,7 +1406,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1458,7 +1438,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1492,7 +1472,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1794,8 +1774,8 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (actual rows=1368 loops=1) Merge Cond: (metrics."time" = metrics_1."time") -> Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) @@ -1804,9 +1784,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -1814,9 +1793,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1824,9 +1802,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2016 @@ -1834,10 +1811,9 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 -(41 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) +(37 rows) -- test prepared statement PREPARE prep AS @@ -1845,25 +1821,23 @@ SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; :PREFIX EXECUTE prep; - QUERY PLAN ------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(16 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(14 rows) EXECUTE prep; count @@ -1925,7 +1899,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1939,7 +1913,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1962,7 +1936,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1976,7 +1950,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1999,7 +1973,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=504 loops=1) @@ -2013,7 +1987,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2024,16 +1998,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2041,18 +2014,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -2060,10 +2032,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -2073,11 +2044,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -2085,26 +2055,24 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count - Heap Fetches: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 2520 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count - Heap Fetches: 5 -(17 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 +(15 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -2116,28 +2084,33 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=0 loops=1) - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Merge Append (actual rows=0 loops=1) Sort Key: _hyper_1_1_chunk."time" - Sort Method: quicksort - -> Append (actual rows=0 loops=1) + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 - Filter: (_hyper_1_2_chunk.device_id_peer = 1) - Rows Removed by Filter: 2520 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 + Filter: (_hyper_1_2_chunk.device_id_peer = 1) + Rows Removed by Filter: 2520 + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(21 rows) +(26 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2150,7 +2123,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) @@ -2160,7 +2133,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) (17 rows) @@ -2179,10 +2152,9 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id_peer = 1) @@ -2190,11 +2162,10 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) +(17 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2219,7 +2190,7 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=2) @@ -2229,7 +2200,7 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) (27 rows) @@ -2246,10 +2217,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2257,11 +2227,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2286,7 +2255,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=2) @@ -2296,7 +2265,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2311,25 +2280,30 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join + Nested Loop Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Unique + Output: "*VALUES*".column1 + -> Sort + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - -> Hash - Output: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 -(18 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(23 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2343,10 +2317,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2354,11 +2327,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2382,7 +2354,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=2) @@ -2392,7 +2364,7 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2441,11 +2413,10 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: ((m1."time" = m2."time") AND (m1.device_id = m2.device_id)) + -> Nested Loop (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2460,22 +2431,21 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Materialize (actual rows=10 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=10 loops=1) - Order: m2."time", m2.device_id - -> Sort (actual rows=10 loops=1) - Sort Key: m2_1."time", m2_1.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) - -> Sort (never executed) - Sort Key: m2_2."time", m2_2.device_id - -> Seq Scan on _hyper_1_2_chunk m2_2 (never executed) - -> Sort (never executed) - Sort Key: m2_3."time", m2_3.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) -(32 rows) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: (m1."time" = "time") + Rows Removed by Filter: 323 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) + Index Cond: (device_id = m1.device_id) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) + Index Cond: ("time" = m1."time") + Filter: (m1.device_id = device_id) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) + Filter: (m1."time" = "time") + Rows Removed by Filter: 504 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) + Index Cond: (device_id = m1.device_id) +(30 rows) :PREFIX SELECT * @@ -2487,12 +2457,13 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: (m1."time" = m3_1."time") + -> Nested Loop (actual rows=10 loops=1) -> Nested Loop (actual rows=10 loops=1) + Join Filter: (m1."time" = m3_1."time") + Rows Removed by Join Filter: 12304 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2507,41 +2478,32 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Append (actual rows=1 loops=10) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) - Filter: (m1."time" = "time") - Rows Removed by Filter: 323 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) - Index Cond: (device_id = m1.device_id) - -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) - Index Cond: ("time" = m1."time") - Filter: (m1.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) - Filter: (m1."time" = "time") - Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) - Index Cond: (device_id = m1.device_id) - -> Materialize (actual rows=10 loops=1) - -> Merge Append (actual rows=3 loops=1) - Sort Key: m3_1."time" - -> Sort (actual rows=3 loops=1) - Sort Key: m3_1."time" - Sort Method: quicksort + -> Materialize (actual rows=1231 loops=10) + -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m3_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 2 - -> Sort (actual rows=1 loops=1) - Sort Key: m3_3."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) + Index Cond: (device_id = 3) + -> Seq Scan on _hyper_1_2_chunk m3_2 (actual rows=504 loops=1) + Filter: (device_id = 3) + Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - Rows Removed by Filter: 4 -(52 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) + Index Cond: (device_id = 3) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: (m1."time" = "time") + Rows Removed by Filter: 323 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=10) + Index Cond: (device_id = m1.device_id) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (actual rows=0 loops=9) + Index Cond: ("time" = m1."time") + Filter: (m1.device_id = device_id) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) + Filter: (m1."time" = "time") + Rows Removed by Filter: 504 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=9) + Index Cond: (device_id = m1.device_id) +(44 rows) :PREFIX SELECT * @@ -2701,8 +2663,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) -> Incremental Sort (actual rows=100 loops=1) Sort Key: m1."time", m1.device_id, m2."time", m2.device_id @@ -2733,17 +2695,16 @@ LIMIT 100; Sort Key: m2_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_3."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) - Filter: (device_id = 2) -(40 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Index Cond: (device_id = 2) +(39 rows) :PREFIX SELECT * @@ -2985,8 +2946,8 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': AND device_id = $1 LIMIT 1) m1 ON TRUE; :PREFIX EXECUTE param_prep (1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -2995,21 +2956,23 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -(18 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) +(20 rows) :PREFIX EXECUTE param_prep (2); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -3018,9 +2981,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 2) @@ -3028,9 +2991,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) (21 rows) EXECUTE param_prep (1); @@ -3189,29 +3152,29 @@ FROM metrics, WHERE metrics.time > metrics_space.time AND metrics.device_id = metrics_space.device_id AND metrics.time < metrics_space.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (actual rows=0 loops=1) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) -> Append (actual rows=0 loops=6840) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=6840) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) @@ -3219,7 +3182,7 @@ WHERE metrics.time > metrics_space.time -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -5323,14 +5286,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5483,14 +5446,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5532,14 +5495,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -6210,7 +6173,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6223,7 +6186,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6246,7 +6209,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6259,7 +6222,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6282,7 +6245,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk test_table_2 (actual rows=504 loops=1) @@ -6295,7 +6258,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6306,16 +6269,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) @@ -6323,18 +6285,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -6342,10 +6303,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6355,11 +6315,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -6367,28 +6326,25 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 504 @@ -6401,19 +6357,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 504 -(44 rows) +(39 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -6434,7 +6388,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6444,7 +6398,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id, _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.v0, _hyper_2_5_chunk.v1, _hyper_2_5_chunk.v2, _hyper_2_5_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6454,7 +6408,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id, _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.v0, _hyper_2_6_chunk.v1, _hyper_2_6_chunk.v2, _hyper_2_6_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6476,7 +6430,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6486,7 +6440,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6506,19 +6460,19 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6536,13 +6490,13 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6769,17 +6723,17 @@ WHERE device_id IN ( -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id = "*VALUES*".column1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk @@ -6793,12 +6747,12 @@ WHERE device_id IN ( Index Cond: (_hyper_2_9_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id = "*VALUES*".column1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk @@ -8028,29 +7982,29 @@ FROM metrics, WHERE metrics.time > metrics_space.time AND metrics.device_id = metrics_space.device_id AND metrics.time < metrics_space.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------ Nested Loop (actual rows=0 loops=1) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) -> Append (actual rows=0 loops=6840) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=6840) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) @@ -8058,7 +8012,7 @@ WHERE metrics.time > metrics_space.time -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 504 - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -8131,73 +8085,49 @@ $$; -- should have ordered DecompressChunk path because segmentby columns have equality constraints :PREFIX SELECT * FROM metrics_ordered WHERE device_id = 1 AND device_id_peer = 3 ORDER BY time DESC LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_ordered (actual rows=0 loops=1) Order: metrics_ordered."time" DESC -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_31_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_30_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_29_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(24 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) +(12 rows) :PREFIX SELECT DISTINCT ON (d.device_id) * FROM metrics_ordered d INNER JOIN LATERAL (SELECT * FROM metrics_ordered m WHERE m.device_id=d.device_id AND m.device_id_peer = 3 ORDER BY time DESC LIMIT 1 ) m ON true; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) -> Merge Append (actual rows=6840 loops=1) Sort Key: d_1.device_id -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=1800 loops=1) - -> Index Scan using compress_hyper_12_29_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_29_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_30_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_30_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_31_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_31_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=5 loops=1) -> Limit (actual rows=0 loops=6840) -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=6840) Order: m."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_31_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_30_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_29_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(35 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) +(23 rows) \ir include/transparent_decompression_systemcolumns.sql -- This file and its contents are licensed under the Timescale License. @@ -9826,8 +9756,8 @@ SET enable_seqscan TO false; -- should order compressed chunks using index -- (we only EXPLAIN here b/c the resulting order is too inconsistent) EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_1_2_chunk.device_id -> Sort @@ -9836,13 +9766,13 @@ EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY dev Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (10 rows) EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_2_7_chunk.device_id -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk @@ -9853,11 +9783,11 @@ EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index 6824bc63ff4..590a87c5d5b 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -190,12 +190,6 @@ FROM _timescaledb_catalog.hypertable ht -- Index created using query saved in variable used because there was -- no standard way to create an index on a compressed table. -- Once a standard way exists, modify this test to use that method. -CREATE INDEX c_index ON :METRICS_COMPRESSED (device_id); -CREATE INDEX c_space_index ON :METRICS_SPACE_COMPRESSED (device_id); -CREATE INDEX c_index_2 ON :METRICS_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX c_space_index_2 ON :METRICS_SPACE_COMPRESSED (device_id, _ts_meta_count); -CREATE INDEX ON :METRICS_COMPRESSED (device_id_peer); -CREATE INDEX ON :METRICS_SPACE_COMPRESSED (device_id_peer); \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER CREATE INDEX ON metrics_space (device_id, device_id_peer, v0, v1 DESC, time); CREATE INDEX ON metrics_space (device_id, device_id_peer DESC, v0, v1 DESC, time); @@ -265,17 +259,16 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) Order: metrics."time" -> Sort (actual rows=360 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -283,10 +276,9 @@ ORDER BY time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(17 rows) -- test expressions :PREFIX @@ -300,32 +292,31 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Result (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=720 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Incremental Sort (actual rows=2736 loops=1) + Sort Key: metrics."time", metrics.device_id + Presorted Key: metrics."time" + Full-sort Groups: 86 Sort Method: quicksort + -> Result (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Order: metrics."time" + -> Sort (actual rows=720 loops=1) + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 1512 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(23 rows) + -> Sort (actual rows=1008 loops=1) + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1008 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=2 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(22 rows) -- test empty targetlist :PREFIX @@ -346,21 +337,19 @@ FROM :TEST_TABLE; SELECT * FROM :TEST_TABLE WHERE device_id < 0; - QUERY PLAN ---------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=0 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) Rows Removed by Filter: 2520 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 5 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(10 rows) -- test targetlist not referencing columns :PREFIX @@ -383,24 +372,22 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test order not present in targetlist :PREFIX @@ -408,45 +395,41 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort -> Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(15 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(13 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(12 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -787,18 +770,15 @@ WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 1795 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_5_15_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) -(9 rows) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Filter: ((_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(6 rows) :PREFIX SELECT * @@ -1358,7 +1338,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1393,7 +1373,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1426,7 +1406,7 @@ LIMIT 100; Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (19 rows) @@ -1458,7 +1438,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1492,7 +1472,7 @@ ORDER BY device_id, Output: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_de on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1794,8 +1774,8 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (actual rows=1368 loops=1) Merge Cond: (metrics."time" = metrics_1."time") -> Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) @@ -1804,9 +1784,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 @@ -1814,9 +1793,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1824,9 +1802,8 @@ ORDER BY q1.time; Sort Key: _hyper_1_1_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2016 @@ -1834,10 +1811,9 @@ ORDER BY q1.time; Sort Key: _hyper_1_3_chunk_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 -(41 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) +(37 rows) -- test prepared statement PREPARE prep AS @@ -1845,25 +1821,23 @@ SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; :PREFIX EXECUTE prep; - QUERY PLAN ------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(16 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) +(14 rows) EXECUTE prep; count @@ -1925,7 +1899,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1939,7 +1913,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1962,7 +1936,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -1976,7 +1950,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1999,7 +1973,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=504 loops=1) @@ -2013,7 +1987,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2024,16 +1998,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2041,18 +2014,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -2060,10 +2032,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) @@ -2073,11 +2044,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -2085,26 +2055,24 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk._ts_meta_count - Heap Fetches: 5 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 2520 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk._ts_meta_count - Heap Fetches: 5 -(17 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 +(15 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -2116,28 +2084,33 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=0 loops=1) - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Merge Append (actual rows=0 loops=1) Sort Key: _hyper_1_1_chunk."time" - Sort Method: quicksort - -> Append (actual rows=0 loops=1) + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 + Sort Key: _hyper_1_1_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id, _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.v0, _hyper_1_1_chunk.v1, _hyper_1_1_chunk.v2, _hyper_1_1_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 - Filter: (_hyper_1_2_chunk.device_id_peer = 1) - Rows Removed by Filter: 2520 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk.v2, _hyper_1_2_chunk.v3 + Filter: (_hyper_1_2_chunk.device_id_peer = 1) + Rows Removed by Filter: 2520 + -> Sort (actual rows=0 loops=1) + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 + Sort Key: _hyper_1_3_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk.v2, _hyper_1_3_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(21 rows) +(26 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2150,7 +2123,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_15_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) @@ -2160,7 +2133,7 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_5_16_chunk__compressed_hypertable_5_device_id_pe on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) (17 rows) @@ -2179,10 +2152,9 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=0 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id_peer = 1) @@ -2190,11 +2162,10 @@ WHERE device_id_peer IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) +(17 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2240,10 +2211,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2251,11 +2221,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2305,13 +2274,13 @@ WHERE device_id IN ( -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_15_chunk + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on _timescaledb_internal.compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 -> Hash Output: "*VALUES*".column1 @@ -2331,10 +2300,9 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3, compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) @@ -2342,11 +2310,10 @@ WHERE device_id IN ( -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3, compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 -(19 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = 1) +(17 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2423,11 +2390,12 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: ((m1."time" = m2."time") AND (m1.device_id = m2.device_id)) + -> Nested Loop (actual rows=10 loops=1) + Join Filter: ((m1."time" = m2_1."time") AND (m2_1.device_id = m1.device_id)) + Rows Removed by Join Filter: 62992 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) @@ -2442,22 +2410,13 @@ FROM :TEST_TABLE m1 Sort Key: m1_3."time", m1_3.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - -> Materialize (actual rows=10 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=10 loops=1) - Order: m2."time", m2.device_id - -> Sort (actual rows=10 loops=1) - Sort Key: m2_1."time", m2_1.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) - -> Sort (never executed) - Sort Key: m2_2."time", m2_2.device_id - -> Seq Scan on _hyper_1_2_chunk m2_2 (never executed) - -> Sort (never executed) - Sort Key: m2_3."time", m2_3.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) -(32 rows) + -> Append (actual rows=6300 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1764 loops=10) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=10) + -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=2520 loops=9) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=2520 loops=9) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=5 loops=9) +(24 rows) :PREFIX SELECT * @@ -2513,14 +2472,13 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=1 loops=1) Filter: (device_id = 3) Rows Removed by Filter: 4 - -> Materialize (actual rows=4561 loops=3) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk m1_2 (actual rows=2520 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -(49 rows) + -> Append (actual rows=4561 loops=3) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1201 loops=3) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=3) + -> Seq Scan on _hyper_1_2_chunk m1_2 (actual rows=2520 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=2520 loops=2) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=2) +(48 rows) :PREFIX SELECT * @@ -2680,8 +2638,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) -> Incremental Sort (actual rows=100 loops=1) Sort Key: m1."time", m1.device_id, m2."time", m2.device_id @@ -2712,17 +2670,16 @@ LIMIT 100; Sort Key: m2_1."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + Index Cond: (device_id = 2) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_3."time" -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (never executed) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) - Filter: (device_id = 2) -(40 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Index Cond: (device_id = 2) +(39 rows) :PREFIX SELECT * @@ -2964,8 +2921,8 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': AND device_id = $1 LIMIT 1) m1 ON TRUE; :PREFIX EXECUTE param_prep (1); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -2974,21 +2931,23 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -(18 rows) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 1) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) +(20 rows) :PREFIX EXECUTE param_prep (2); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=19 loops=1) -> Function Scan on generate_series g (actual rows=32 loops=1) -> Limit (actual rows=1 loops=32) @@ -2997,9 +2956,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") Rows Removed by Filter: 168 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=5) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=5) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) Index Cond: ("time" = g."time") Filter: (device_id = 2) @@ -3007,9 +2966,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=7) - Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=7) + Index Cond: (device_id = 2) + Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) (21 rows) EXECUTE param_prep (1); @@ -3175,25 +3134,25 @@ WHERE metrics.time > metrics_space.time Rows Removed by Join Filter: 46785600 -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=5 loops=1) -> Materialize (actual rows=6840 loops=6840) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) (25 rows) @@ -5297,14 +5256,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5457,14 +5416,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -5506,14 +5465,14 @@ ORDER BY device_id, Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1 Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_de on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v1_ on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) @@ -6184,7 +6143,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6197,7 +6156,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6220,7 +6179,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6233,7 +6192,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6256,7 +6215,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=360 loops=1) Output: test_table_1.*, test_table_1.device_id, test_table_1."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk test_table_2 (actual rows=504 loops=1) @@ -6269,7 +6228,7 @@ ORDER BY device_id, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=504 loops=1) Output: test_table_3.*, test_table_3.device_id, test_table_3."time" Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6280,16 +6239,15 @@ SELECT device_id FROM :TEST_TABLE WHERE device_id = 1 ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=1368 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) @@ -6297,18 +6255,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(19 rows) +(17 rows) :PREFIX_VERBOSE SELECT count(*) FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate (actual rows=1 loops=1) Output: count(*) -> Append (actual rows=3 loops=1) @@ -6316,10 +6273,9 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - Heap Fetches: 1 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) @@ -6329,11 +6285,10 @@ WHERE device_id = 1; Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) - Heap Fetches: 1 -(24 rows) +(22 rows) -- should be able to order using an index CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); @@ -6341,28 +6296,25 @@ CREATE INDEX tmp_idx ON :TEST_TABLE (device_id); SELECT device_id FROM :TEST_TABLE ORDER BY device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Append (actual rows=6840 loops=1) Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 504 @@ -6375,19 +6327,17 @@ ORDER BY device_id; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk._ts_meta_count - Heap Fetches: 1 + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Index Only Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk._ts_meta_count - Heap Fetches: 3 + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 504 -(44 rows) +(39 rows) DROP INDEX tmp_idx CASCADE; --use the peer index @@ -6408,7 +6358,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id, _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.v0, _hyper_2_4_chunk.v1, _hyper_2_4_chunk.v2, _hyper_2_4_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6418,7 +6368,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id, _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.v0, _hyper_2_5_chunk.v1, _hyper_2_5_chunk.v2, _hyper_2_5_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6428,7 +6378,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id, _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.v0, _hyper_2_6_chunk.v1, _hyper_2_6_chunk.v2, _hyper_2_6_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6450,7 +6400,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.v0, _hyper_2_10_chunk.v1, _hyper_2_10_chunk.v2, _hyper_2_10_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Sort (actual rows=0 loops=1) @@ -6460,7 +6410,7 @@ ORDER BY device_id_peer, -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.v0, _hyper_2_11_chunk.v1, _hyper_2_11_chunk.v2, _hyper_2_11_chunk.v3 Bulk Decompression: true - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6480,19 +6430,19 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_17_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_18_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_19_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_19_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) @@ -6510,13 +6460,13 @@ ORDER BY device_id_peer; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_20_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Index Scan using compress_hyper_6_21_chunk__compressed_hypertable_6_device_id_pe on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 Index Cond: (compress_hyper_6_21_chunk.device_id_peer = 1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) @@ -6737,15 +6687,15 @@ WHERE device_id IN ( -> Append -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_17_chunk + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3, compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_18_chunk + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3, compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_19_chunk + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3, compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3 -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_7_chunk Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id @@ -6755,11 +6705,11 @@ WHERE device_id IN ( Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3, compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on _timescaledb_internal.compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3, compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id @@ -7998,25 +7948,25 @@ WHERE metrics.time > metrics_space.time Rows Removed by Join Filter: 46785600 -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) - -> Index Scan using compress_hyper_5_15_chunk_c_index_2 on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=5 loops=1) -> Materialize (actual rows=6840 loops=6840) -> Append (actual rows=6840 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_17_chunk_c_space_index_2 on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_17_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Index Scan using compress_hyper_6_18_chunk_c_space_index_2 on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_18_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) - -> Index Scan using compress_hyper_6_19_chunk_c_space_index_2 on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_19_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=504 loops=1) -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1512 loops=1) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=504 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=504 loops=1) (25 rows) @@ -8089,73 +8039,49 @@ $$; -- should have ordered DecompressChunk path because segmentby columns have equality constraints :PREFIX SELECT * FROM metrics_ordered WHERE device_id = 1 AND device_id_peer = 3 ORDER BY time DESC LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_ordered (actual rows=0 loops=1) Order: metrics_ordered."time" DESC -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_31_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_30_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: compress_hyper_12_29_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk (actual rows=0 loops=1) - Filter: ((device_id = 1) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(24 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=0 loops=1) + Index Cond: ((device_id = 1) AND (device_id_peer = 3)) +(12 rows) :PREFIX SELECT DISTINCT ON (d.device_id) * FROM metrics_ordered d INNER JOIN LATERAL (SELECT * FROM metrics_ordered m WHERE m.device_id=d.device_id AND m.device_id_peer = 3 ORDER BY time DESC LIMIT 1 ) m ON true; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) -> Merge Append (actual rows=6840 loops=1) Sort Key: d_1.device_id -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=1800 loops=1) - -> Index Scan using compress_hyper_12_29_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_29_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_30_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_30_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=2520 loops=1) - -> Index Scan using compress_hyper_12_31_chunk__compressed_hypertable_12_device_id_ on compress_hyper_12_31_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=5 loops=1) -> Limit (actual rows=0 loops=6840) -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=6840) Order: m."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_31_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_31_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk compress_hyper_12_31_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_30_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_12_30_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_30_chunk compress_hyper_12_30_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=6840) - -> Sort (actual rows=0 loops=6840) - Sort Key: compress_hyper_12_29_chunk_1._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) - Filter: ((device_id = d_1.device_id) AND (device_id_peer = 3)) - Rows Removed by Filter: 5 -(35 rows) + -> Index Scan using compress_hyper_12_29_chunk_device_id_device_id_peer__ts_met_idx on compress_hyper_12_29_chunk compress_hyper_12_29_chunk_1 (actual rows=0 loops=6840) + Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) +(23 rows) \ir include/transparent_decompression_systemcolumns.sql -- This file and its contents are licensed under the Timescale License. @@ -9784,8 +9710,8 @@ SET enable_seqscan TO false; -- should order compressed chunks using index -- (we only EXPLAIN here b/c the resulting order is too inconsistent) EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_1_2_chunk.device_id -> Sort @@ -9794,13 +9720,13 @@ EXPLAIN (costs off) SELECT * FROM metrics WHERE time > '2000-01-08' ORDER BY dev Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_5_16_chunk_c_index_2 on compress_hyper_5_16_chunk + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (10 rows) EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER BY device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_2_7_chunk.device_id -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk @@ -9811,11 +9737,11 @@ EXPLAIN (costs off) SELECT * FROM metrics_space WHERE time > '2000-01-08' ORDER Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_20_chunk_c_space_index_2 on compress_hyper_6_20_chunk + -> Index Scan using compress_hyper_6_20_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_20_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using compress_hyper_6_21_chunk_c_space_index_2 on compress_hyper_6_21_chunk + -> Index Scan using compress_hyper_6_21_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_6_21_chunk Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk Index Cond: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) diff --git a/tsl/test/expected/transparent_decompression_join_index-13.out b/tsl/test/expected/transparent_decompression_join_index-13.out index 8b160aaf12e..4fd9ab3fcfc 100644 --- a/tsl/test/expected/transparent_decompression_join_index-13.out +++ b/tsl/test/expected/transparent_decompression_join_index-13.out @@ -67,7 +67,7 @@ order by test.time; Filter: (((a)::text = ANY ('{lat,lon}'::text[])) AND (b = 1)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk Vectorized Filter: (("time" >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND ("time" <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_a_b__ts_meta_ on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_a_b__ts_meta_sequence_num_idx on compress_hyper_2_2_chunk Index Cond: ((a = (test_copy.a)::text) AND (b = test_copy.b)) Filter: ((_ts_meta_max_1 >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND (_ts_meta_min_1 <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) (13 rows) diff --git a/tsl/test/expected/transparent_decompression_join_index-14.out b/tsl/test/expected/transparent_decompression_join_index-14.out index 8b160aaf12e..4fd9ab3fcfc 100644 --- a/tsl/test/expected/transparent_decompression_join_index-14.out +++ b/tsl/test/expected/transparent_decompression_join_index-14.out @@ -67,7 +67,7 @@ order by test.time; Filter: (((a)::text = ANY ('{lat,lon}'::text[])) AND (b = 1)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk Vectorized Filter: (("time" >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND ("time" <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_a_b__ts_meta_ on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_a_b__ts_meta_sequence_num_idx on compress_hyper_2_2_chunk Index Cond: ((a = (test_copy.a)::text) AND (b = test_copy.b)) Filter: ((_ts_meta_max_1 >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND (_ts_meta_min_1 <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) (13 rows) diff --git a/tsl/test/expected/transparent_decompression_join_index-15.out b/tsl/test/expected/transparent_decompression_join_index-15.out index 8b160aaf12e..4fd9ab3fcfc 100644 --- a/tsl/test/expected/transparent_decompression_join_index-15.out +++ b/tsl/test/expected/transparent_decompression_join_index-15.out @@ -67,7 +67,7 @@ order by test.time; Filter: (((a)::text = ANY ('{lat,lon}'::text[])) AND (b = 1)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk Vectorized Filter: (("time" >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND ("time" <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_2_chunk__compressed_hypertable_2_a_b__ts_meta_ on compress_hyper_2_2_chunk + -> Index Scan using compress_hyper_2_2_chunk_a_b__ts_meta_sequence_num_idx on compress_hyper_2_2_chunk Index Cond: ((a = (test_copy.a)::text) AND (b = test_copy.b)) Filter: ((_ts_meta_max_1 >= 'Wed Jan 01 00:00:00 2020 PST'::timestamp with time zone) AND (_ts_meta_min_1 <= 'Wed Jan 01 00:02:00 2020 PST'::timestamp with time zone)) (13 rows) diff --git a/tsl/test/expected/transparent_decompression_ordered_index-13.out b/tsl/test/expected/transparent_decompression_ordered_index-13.out index 2a2f07797b6..c6ad63745c1 100644 --- a/tsl/test/expected/transparent_decompression_ordered_index-13.out +++ b/tsl/test/expected/transparent_decompression_ordered_index-13.out @@ -149,7 +149,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -161,7 +161,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -173,7 +173,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Sort Key: _hyper_3_11_chunk."time" DESC, _hyper_3_11_chunk.v0 DESC Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk (actual rows=4291 loops=1) - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -191,7 +191,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk m_2 (actual rows=1 loops=4291) - -> Index Scan Backward using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) + -> Index Scan Backward using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (12 rows) @@ -273,29 +273,29 @@ ORDER BY 1, -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=0 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_8_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_7_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (never executed) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_6_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (34 rows) @@ -322,22 +322,22 @@ WHERE extract(minute FROM d.time) = 0; -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk d_1 (actual rows=120 loops=1) Filter: (date_part('minute'::text, "time") = '0'::double precision) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk d_2 (actual rows=240 loops=1) Filter: (date_part('minute'::text, "time") = '0'::double precision) Rows Removed by Filter: 720 - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk d_3 (actual rows=12 loops=1) Filter: (date_part('minute'::text, "time") = '0'::double precision) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk d_4 (actual rows=12 loops=1) Filter: (date_part('minute'::text, "time") = '0'::double precision) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk d_5 (actual rows=5 loops=1) Filter: (date_part('minute'::text, "time") = '0'::double precision) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=5 loops=1) -> Subquery Scan on m (actual rows=0 loops=389) Filter: (d.device_id_peer = m.device_id_peer) Rows Removed by Filter: 0 @@ -346,19 +346,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (48 rows) @@ -407,19 +407,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (44 rows) @@ -440,28 +440,40 @@ FROM ( AND mt.device_id = nd.node AND mt.time < nd.stop_time) AS subq GROUP BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- GroupAggregate (actual rows=1 loops=1) Group Key: mt_1.device_id - -> Nested Loop (actual rows=48 loops=1) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time) AND (mt_1.device_id = nd.node)) - Rows Removed by Join Filter: 1493 - -> Merge Append (actual rows=1541 loops=1) - Sort Key: mt_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Materialize (actual rows=1 loops=1541) + -> Sort (actual rows=48 loops=1) + Sort Key: mt_1.device_id + Sort Method: quicksort + -> Nested Loop (actual rows=48 loops=1) -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(19 rows) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(31 rows) :PREFIX SELECT nd.node, @@ -474,39 +486,36 @@ WHERE mt.time > nd.start_time ORDER BY time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=48 loops=1) - Join Filter: ((mt."time" > nd.start_time) AND (mt."time" < nd.stop_time) AND (mt.device_id = nd.node)) - Rows Removed by Join Filter: 1493 - -> Custom Scan (ChunkAppend) on metrics_ordered_idx mt (actual rows=1541 loops=1) - Order: mt."time" - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_6_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_7_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_8_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Materialize (actual rows=1 loops=1541) + Sort (actual rows=48 loops=1) + Sort Key: mt_1."time" + Sort Method: quicksort + -> Nested Loop (actual rows=48 loops=1) -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(32 rows) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) SET enable_seqscan = TRUE; SET enable_bitmapscan = TRUE; @@ -524,34 +533,38 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort - -> Merge Join (actual rows=48 loops=1) - Merge Cond: (nd.node = mt_1.device_id) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time)) - Rows Removed by Join Filter: 289 - -> Sort (actual rows=1 loops=1) - Sort Key: nd.node - Sort Method: quicksort - -> Seq Scan on nodetime nd (actual rows=1 loops=1) - -> Sort (actual rows=1250 loops=1) - Sort Key: mt_1.device_id - Sort Method: quicksort - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) -(25 rows) + -> Nested Loop (actual rows=48 loops=1) + -> Seq Scan on nodetime nd (actual rows=1 loops=1) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) SET enable_mergejoin = FALSE; SET enable_hashjoin = TRUE; @@ -564,30 +577,38 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort - -> Hash Join (actual rows=48 loops=1) - Hash Cond: (mt_1.device_id = nd.node) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time)) - Rows Removed by Join Filter: 289 - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Nested Loop (actual rows=48 loops=1) + -> Seq Scan on nodetime nd (actual rows=1 loops=1) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Hash (actual rows=1 loops=1) - Buckets: 2048 Batches: 1 - -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(21 rows) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) --enable all joins after the tests SET enable_mergejoin = TRUE; @@ -616,7 +637,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' Filter: ("*VALUES*".column2 = v0) Rows Removed by Filter: 47 Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=2) Index Cond: (device_id = "*VALUES*".column1) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (9 rows) @@ -639,7 +660,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone) AND (v0 = 5)) Rows Removed by Filter: 47 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -661,7 +682,7 @@ WHERE met.time = '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=0 loops=1) Vectorized Filter: ((v0 = 5) AND ("time" = 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) Rows Removed by Filter: 48 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) Filter: ((_ts_meta_min_1 <= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -688,7 +709,7 @@ ON met.device_id = q.node and met.device_id_peer = q.device_id_peer Filter: ("*VALUES*".column3 = v0) Rows Removed by Filter: 47 Vectorized Filter: ((v0 > 2) AND ("time" = 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) Index Cond: ((device_id = "*VALUES*".column1) AND (device_id_peer = "*VALUES*".column2)) Filter: ((_ts_meta_min_1 <= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) (14 rows) @@ -789,8 +810,8 @@ ORDER BY 1, 2, 3, 4; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (actual rows=10 loops=1) Sort Key: metrics_ordered_idx."time", metrics_ordered_idx.device_id, metrics_ordered_idx.device_id_peer, metrics_ordered_idx.v0 Sort Method: quicksort @@ -802,20 +823,15 @@ ORDER BY 1, Sort Key: _hyper_1_4_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=9 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) - Rows Removed by Filter: 4 -(24 rows) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) +(19 rows) :PREFIX SELECT m.device_id, @@ -948,17 +964,15 @@ ORDER BY m.v0; Sort (actual rows=0 loops=1) Sort Key: m.v0 Sort Method: quicksort - -> Hash Join (actual rows=0 loops=1) - Hash Cond: (m.device_id = d.device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) + -> Nested Loop (actual rows=0 loops=1) + -> Seq Scan on device_tbl d (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=7) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=7) + Index Cond: (device_id = d.device_id) Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 - -> Hash (actual rows=7 loops=1) - Buckets: 1024 Batches: 1 - -> Seq Scan on device_tbl d (actual rows=7 loops=1) -(13 rows) + Rows Removed by Filter: 0 +(11 rows) -- no matches in metrics_ordered_idx but one row in device_tbl :PREFIX @@ -970,8 +984,8 @@ FROM device_tbl d AND m.time < '2000-01-01 0:00:00+0'::text::timestamptz WHERE d.device_id = 8 ORDER BY m.v0; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1 loops=1) Sort Key: m.v0 Sort Method: quicksort @@ -982,9 +996,9 @@ ORDER BY m.v0; Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (device_id = 8) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 8) + Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) (13 rows) -- no matches in device_tbl but 1 row in metrics_ordered_idx @@ -1007,31 +1021,26 @@ ORDER BY m.v0; Join Filter: ((m_1."time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (m_1."time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) -> Append (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_2 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_4 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_5 (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 7) -> Hash (actual rows=0 loops=1) Buckets: 1024 Batches: 1 -> Seq Scan on device_tbl d (actual rows=0 loops=1) Filter: (device_id = 7) Rows Removed by Filter: 7 -(32 rows) +(27 rows) SET timescaledb.enable_chunk_append TO TRUE; -- github bug 2917 with UNION ALL that references compressed ht diff --git a/tsl/test/expected/transparent_decompression_ordered_index-14.out b/tsl/test/expected/transparent_decompression_ordered_index-14.out index 7f7764365d6..3d881d1adc5 100644 --- a/tsl/test/expected/transparent_decompression_ordered_index-14.out +++ b/tsl/test/expected/transparent_decompression_ordered_index-14.out @@ -149,7 +149,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -161,7 +161,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -173,7 +173,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Sort Key: _hyper_3_11_chunk."time" DESC, _hyper_3_11_chunk.v0 DESC Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk (actual rows=4291 loops=1) - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -191,7 +191,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk m_2 (actual rows=1 loops=4291) - -> Index Scan Backward using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) + -> Index Scan Backward using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (12 rows) @@ -273,29 +273,29 @@ ORDER BY 1, -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=0 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_8_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_7_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (never executed) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_6_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (34 rows) @@ -322,22 +322,22 @@ WHERE extract(minute FROM d.time) = 0; -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk d_1 (actual rows=120 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk d_2 (actual rows=240 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 720 - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk d_3 (actual rows=12 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk d_4 (actual rows=12 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk d_5 (actual rows=5 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=5 loops=1) -> Subquery Scan on m (actual rows=0 loops=389) Filter: (d.device_id_peer = m.device_id_peer) Rows Removed by Filter: 0 @@ -346,19 +346,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (48 rows) @@ -407,19 +407,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (44 rows) @@ -440,28 +440,40 @@ FROM ( AND mt.device_id = nd.node AND mt.time < nd.stop_time) AS subq GROUP BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- GroupAggregate (actual rows=1 loops=1) Group Key: mt_1.device_id - -> Nested Loop (actual rows=48 loops=1) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time) AND (mt_1.device_id = nd.node)) - Rows Removed by Join Filter: 1493 - -> Merge Append (actual rows=1541 loops=1) - Sort Key: mt_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Materialize (actual rows=1 loops=1541) + -> Sort (actual rows=48 loops=1) + Sort Key: mt_1.device_id + Sort Method: quicksort + -> Nested Loop (actual rows=48 loops=1) -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(19 rows) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(31 rows) :PREFIX SELECT nd.node, @@ -474,39 +486,36 @@ WHERE mt.time > nd.start_time ORDER BY time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=48 loops=1) - Join Filter: ((mt."time" > nd.start_time) AND (mt."time" < nd.stop_time) AND (mt.device_id = nd.node)) - Rows Removed by Join Filter: 1493 - -> Custom Scan (ChunkAppend) on metrics_ordered_idx mt (actual rows=1541 loops=1) - Order: mt."time" - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_6_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_7_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_8_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Materialize (actual rows=1 loops=1541) + Sort (actual rows=48 loops=1) + Sort Key: mt_1."time" + Sort Method: quicksort + -> Nested Loop (actual rows=48 loops=1) -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(32 rows) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) SET enable_seqscan = TRUE; SET enable_bitmapscan = TRUE; @@ -524,34 +533,38 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort - -> Merge Join (actual rows=48 loops=1) - Merge Cond: (nd.node = mt_1.device_id) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time)) - Rows Removed by Join Filter: 289 - -> Sort (actual rows=1 loops=1) - Sort Key: nd.node - Sort Method: quicksort - -> Seq Scan on nodetime nd (actual rows=1 loops=1) - -> Sort (actual rows=1250 loops=1) - Sort Key: mt_1.device_id - Sort Method: quicksort - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) -(25 rows) + -> Nested Loop (actual rows=48 loops=1) + -> Seq Scan on nodetime nd (actual rows=1 loops=1) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) SET enable_mergejoin = FALSE; SET enable_hashjoin = TRUE; @@ -564,30 +577,38 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort - -> Hash Join (actual rows=48 loops=1) - Hash Cond: (mt_1.device_id = nd.node) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time)) - Rows Removed by Join Filter: 289 - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Nested Loop (actual rows=48 loops=1) + -> Seq Scan on nodetime nd (actual rows=1 loops=1) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Hash (actual rows=1 loops=1) - Buckets: 2048 Batches: 1 - -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(21 rows) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) --enable all joins after the tests SET enable_mergejoin = TRUE; @@ -616,7 +637,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' Filter: ("*VALUES*".column2 = v0) Rows Removed by Filter: 47 Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=2) Index Cond: (device_id = "*VALUES*".column1) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (9 rows) @@ -639,7 +660,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone) AND (v0 = 5)) Rows Removed by Filter: 47 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -661,7 +682,7 @@ WHERE met.time = '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=0 loops=1) Vectorized Filter: ((v0 = 5) AND ("time" = 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) Rows Removed by Filter: 48 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) Filter: ((_ts_meta_min_1 <= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -688,7 +709,7 @@ ON met.device_id = q.node and met.device_id_peer = q.device_id_peer Filter: ("*VALUES*".column3 = v0) Rows Removed by Filter: 47 Vectorized Filter: ((v0 > 2) AND ("time" = 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) Index Cond: ((device_id = "*VALUES*".column1) AND (device_id_peer = "*VALUES*".column2)) Filter: ((_ts_meta_min_1 <= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) (14 rows) @@ -789,8 +810,8 @@ ORDER BY 1, 2, 3, 4; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (actual rows=10 loops=1) Sort Key: metrics_ordered_idx."time", metrics_ordered_idx.device_id, metrics_ordered_idx.device_id_peer, metrics_ordered_idx.v0 Sort Method: quicksort @@ -802,20 +823,15 @@ ORDER BY 1, Sort Key: _hyper_1_4_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=9 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) - Rows Removed by Filter: 4 -(24 rows) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) +(19 rows) :PREFIX SELECT m.device_id, @@ -948,17 +964,15 @@ ORDER BY m.v0; Sort (actual rows=0 loops=1) Sort Key: m.v0 Sort Method: quicksort - -> Hash Join (actual rows=0 loops=1) - Hash Cond: (m.device_id = d.device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) + -> Nested Loop (actual rows=0 loops=1) + -> Seq Scan on device_tbl d (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=7) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=7) + Index Cond: (device_id = d.device_id) Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 - -> Hash (actual rows=7 loops=1) - Buckets: 1024 Batches: 1 - -> Seq Scan on device_tbl d (actual rows=7 loops=1) -(13 rows) + Rows Removed by Filter: 0 +(11 rows) -- no matches in metrics_ordered_idx but one row in device_tbl :PREFIX @@ -970,8 +984,8 @@ FROM device_tbl d AND m.time < '2000-01-01 0:00:00+0'::text::timestamptz WHERE d.device_id = 8 ORDER BY m.v0; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1 loops=1) Sort Key: m.v0 Sort Method: quicksort @@ -982,9 +996,9 @@ ORDER BY m.v0; Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (device_id = 8) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 8) + Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) (13 rows) -- no matches in device_tbl but 1 row in metrics_ordered_idx @@ -1007,31 +1021,26 @@ ORDER BY m.v0; Join Filter: ((m_1."time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (m_1."time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) -> Append (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_2 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_4 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_5 (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 7) -> Hash (actual rows=0 loops=1) Buckets: 1024 Batches: 1 -> Seq Scan on device_tbl d (actual rows=0 loops=1) Filter: (device_id = 7) Rows Removed by Filter: 7 -(32 rows) +(27 rows) SET timescaledb.enable_chunk_append TO TRUE; -- github bug 2917 with UNION ALL that references compressed ht diff --git a/tsl/test/expected/transparent_decompression_ordered_index-15.out b/tsl/test/expected/transparent_decompression_ordered_index-15.out index ee1e0cca480..703add3c7cb 100644 --- a/tsl/test/expected/transparent_decompression_ordered_index-15.out +++ b/tsl/test/expected/transparent_decompression_ordered_index-15.out @@ -149,7 +149,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -161,7 +161,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -173,7 +173,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Sort Key: _hyper_3_11_chunk."time" DESC, _hyper_3_11_chunk.v0 DESC Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk (actual rows=4291 loops=1) - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -192,7 +192,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk m_2 (actual rows=1 loops=4291) - -> Index Scan Backward using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) + -> Index Scan Backward using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (13 rows) @@ -274,29 +274,29 @@ ORDER BY 1, -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=0 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_8_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_7_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (never executed) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_6_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (34 rows) @@ -323,22 +323,22 @@ WHERE extract(minute FROM d.time) = 0; -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk d_1 (actual rows=120 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk d_2 (actual rows=240 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 720 - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk d_3 (actual rows=12 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk d_4 (actual rows=12 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk d_5 (actual rows=5 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=5 loops=1) -> Subquery Scan on m (actual rows=0 loops=389) Filter: (d.device_id_peer = m.device_id_peer) Rows Removed by Filter: 0 @@ -347,19 +347,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (48 rows) @@ -409,19 +409,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (45 rows) @@ -442,28 +442,40 @@ FROM ( AND mt.device_id = nd.node AND mt.time < nd.stop_time) AS subq GROUP BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- GroupAggregate (actual rows=1 loops=1) Group Key: mt_1.device_id - -> Nested Loop (actual rows=48 loops=1) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time) AND (mt_1.device_id = nd.node)) - Rows Removed by Join Filter: 1493 - -> Merge Append (actual rows=1541 loops=1) - Sort Key: mt_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Materialize (actual rows=1 loops=1541) + -> Sort (actual rows=48 loops=1) + Sort Key: mt_1.device_id + Sort Method: quicksort + -> Nested Loop (actual rows=48 loops=1) -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(19 rows) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(31 rows) :PREFIX SELECT nd.node, @@ -476,39 +488,36 @@ WHERE mt.time > nd.start_time ORDER BY time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=48 loops=1) - Join Filter: ((mt."time" > nd.start_time) AND (mt."time" < nd.stop_time) AND (mt.device_id = nd.node)) - Rows Removed by Join Filter: 1493 - -> Custom Scan (ChunkAppend) on metrics_ordered_idx mt (actual rows=1541 loops=1) - Order: mt."time" - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_6_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_7_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_8_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Materialize (actual rows=1 loops=1541) + Sort (actual rows=48 loops=1) + Sort Key: mt_1."time" + Sort Method: quicksort + -> Nested Loop (actual rows=48 loops=1) -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(32 rows) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) SET enable_seqscan = TRUE; SET enable_bitmapscan = TRUE; @@ -526,34 +535,38 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort - -> Merge Join (actual rows=48 loops=1) - Merge Cond: (nd.node = mt_1.device_id) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time)) - Rows Removed by Join Filter: 289 - -> Sort (actual rows=1 loops=1) - Sort Key: nd.node - Sort Method: quicksort - -> Seq Scan on nodetime nd (actual rows=1 loops=1) - -> Sort (actual rows=1250 loops=1) - Sort Key: mt_1.device_id - Sort Method: quicksort - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) -(25 rows) + -> Nested Loop (actual rows=48 loops=1) + -> Seq Scan on nodetime nd (actual rows=1 loops=1) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) SET enable_mergejoin = FALSE; SET enable_hashjoin = TRUE; @@ -566,30 +579,38 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort - -> Hash Join (actual rows=48 loops=1) - Hash Cond: (mt_1.device_id = nd.node) - Join Filter: ((mt_1."time" > nd.start_time) AND (mt_1."time" < nd.stop_time)) - Rows Removed by Join Filter: 289 - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Nested Loop (actual rows=48 loops=1) + -> Seq Scan on nodetime nd (actual rows=1 loops=1) + -> Append (actual rows=48 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 96 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 192 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = nd.node) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) - -> Hash (actual rows=1 loops=1) - Buckets: 2048 Batches: 1 - -> Seq Scan on nodetime nd (actual rows=1 loops=1) -(21 rows) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=0 loops=1) + Filter: (("time" > nd.start_time) AND ("time" < nd.stop_time)) + Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = nd.node) +(29 rows) --enable all joins after the tests SET enable_mergejoin = TRUE; @@ -618,7 +639,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' Filter: ("*VALUES*".column2 = v0) Rows Removed by Filter: 47 Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=2) Index Cond: (device_id = "*VALUES*".column1) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (9 rows) @@ -641,7 +662,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone) AND (v0 = 5)) Rows Removed by Filter: 47 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -663,7 +684,7 @@ WHERE met.time = '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=0 loops=1) Vectorized Filter: ((v0 = 5) AND ("time" = 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) Rows Removed by Filter: 48 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) Filter: ((_ts_meta_min_1 <= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -690,7 +711,7 @@ ON met.device_id = q.node and met.device_id_peer = q.device_id_peer Filter: ("*VALUES*".column3 = v0) Rows Removed by Filter: 47 Vectorized Filter: ((v0 > 2) AND ("time" = 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) Index Cond: ((device_id = "*VALUES*".column1) AND (device_id_peer = "*VALUES*".column2)) Filter: ((_ts_meta_min_1 <= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) (14 rows) @@ -791,8 +812,8 @@ ORDER BY 1, 2, 3, 4; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (actual rows=10 loops=1) Sort Key: metrics_ordered_idx."time", metrics_ordered_idx.device_id, metrics_ordered_idx.device_id_peer, metrics_ordered_idx.v0 Sort Method: quicksort @@ -804,20 +825,15 @@ ORDER BY 1, Sort Key: _hyper_1_4_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=9 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) - Rows Removed by Filter: 4 -(24 rows) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) +(19 rows) :PREFIX SELECT m.device_id, @@ -950,17 +966,15 @@ ORDER BY m.v0; Sort (actual rows=0 loops=1) Sort Key: m.v0 Sort Method: quicksort - -> Hash Join (actual rows=0 loops=1) - Hash Cond: (m.device_id = d.device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) + -> Nested Loop (actual rows=0 loops=1) + -> Seq Scan on device_tbl d (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=7) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=7) + Index Cond: (device_id = d.device_id) Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 - -> Hash (actual rows=7 loops=1) - Buckets: 1024 Batches: 1 - -> Seq Scan on device_tbl d (actual rows=7 loops=1) -(13 rows) + Rows Removed by Filter: 0 +(11 rows) -- no matches in metrics_ordered_idx but one row in device_tbl :PREFIX @@ -972,8 +986,8 @@ FROM device_tbl d AND m.time < '2000-01-01 0:00:00+0'::text::timestamptz WHERE d.device_id = 8 ORDER BY m.v0; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1 loops=1) Sort Key: m.v0 Sort Method: quicksort @@ -984,9 +998,9 @@ ORDER BY m.v0; Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (device_id = 8) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 8) + Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) (13 rows) -- no matches in device_tbl but 1 row in metrics_ordered_idx @@ -1009,31 +1023,26 @@ ORDER BY m.v0; Join Filter: ((m_1."time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (m_1."time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) -> Append (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_2 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_4 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_5 (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 4 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 7) -> Hash (actual rows=0 loops=1) Buckets: 1024 Batches: 1 -> Seq Scan on device_tbl d (actual rows=0 loops=1) Filter: (device_id = 7) Rows Removed by Filter: 7 -(32 rows) +(27 rows) SET timescaledb.enable_chunk_append TO TRUE; -- github bug 2917 with UNION ALL that references compressed ht diff --git a/tsl/test/expected/transparent_decompression_ordered_index-16.out b/tsl/test/expected/transparent_decompression_ordered_index-16.out index bb17e882728..5d1df490cd6 100644 --- a/tsl/test/expected/transparent_decompression_ordered_index-16.out +++ b/tsl/test/expected/transparent_decompression_ordered_index-16.out @@ -149,7 +149,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -161,7 +161,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_4_12_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -173,7 +173,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Sort Key: _hyper_3_11_chunk."time" DESC, _hyper_3_11_chunk.v0 DESC Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk (actual rows=4291 loops=1) - -> Index Scan using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk (actual rows=5 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (7 rows) @@ -192,7 +192,7 @@ SELECT count(compress_chunk(ch)) FROM show_chunks('metrics_ordered_idx2') ch; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_3_11_chunk m_2 (actual rows=1 loops=4291) - -> Index Scan Backward using compress_hyper_4_12_chunk__compressed_hypertable_4_device_id_de on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) + -> Index Scan Backward using compress_hyper_4_12_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_4_12_chunk compress_hyper_4_12_chunk_1 (actual rows=1 loops=4291) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (13 rows) @@ -274,29 +274,29 @@ ORDER BY 1, -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=0 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_8_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_7_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (never executed) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_2_6_chunk._ts_meta_sequence_num DESC - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (never executed) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (never executed) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) (34 rows) @@ -323,22 +323,22 @@ WHERE extract(minute FROM d.time) = 0; -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk d_1 (actual rows=120 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 360 - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk d_2 (actual rows=240 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 720 - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk d_3 (actual rows=12 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk d_4 (actual rows=12 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) Rows Removed by Filter: 36 - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk d_5 (actual rows=5 loops=1) Filter: (EXTRACT(minute FROM "time") = '0'::numeric) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=5 loops=1) -> Subquery Scan on m (actual rows=0 loops=389) Filter: (d.device_id_peer = m.device_id_peer) Rows Removed by Filter: 0 @@ -347,19 +347,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (48 rows) @@ -409,19 +409,19 @@ WHERE extract(minute FROM d.time) = 0; Order: m_1."time" DESC Hypertables excluded during runtime: 0 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_2 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk compress_hyper_2_10_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_3 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk compress_hyper_2_9_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_4 (actual rows=0 loops=388) - -> Index Scan Backward using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) + -> Index Scan Backward using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk compress_hyper_2_8_chunk_1 (actual rows=0 loops=388) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_5 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk compress_hyper_2_7_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_6 (actual rows=0 loops=304) - -> Index Scan Backward using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) + -> Index Scan Backward using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk compress_hyper_2_6_chunk_1 (actual rows=0 loops=304) Index Cond: ((device_id = d.device_id) AND (device_id_peer = 3)) (45 rows) @@ -452,15 +452,15 @@ GROUP BY device_id; -> Merge Append (actual rows=1541 loops=1) Sort Key: mt_1.device_id -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=5 loops=1) -> Materialize (actual rows=1 loops=1541) -> Seq Scan on nodetime nd (actual rows=1 loops=1) (19 rows) @@ -485,27 +485,27 @@ ORDER BY time; -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_2_6_chunk._ts_meta_min_1 Sort Method: quicksort - -> Index Scan using compress_hyper_2_6_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_2_7_chunk._ts_meta_min_1 Sort Method: quicksort - -> Index Scan using compress_hyper_2_7_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_8_chunk._ts_meta_min_1 Sort Method: quicksort - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_2_9_chunk._ts_meta_min_1 Sort Method: quicksort - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_2_10_chunk._ts_meta_min_1 Sort Method: quicksort - -> Index Scan using compress_hyper_2_10_chunk__compressed_hypertable_2_device_id_de on compress_hyper_2_10_chunk (actual rows=5 loops=1) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=5 loops=1) -> Materialize (actual rows=1 loops=1541) -> Seq Scan on nodetime nd (actual rows=1 loops=1) (32 rows) @@ -526,8 +526,8 @@ WHERE mt.time > nd.start_time AND mt.device_id = nd.node AND mt.time < nd.stop_time ORDER BY time; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- Sort (actual rows=48 loops=1) Sort Key: mt_1."time" Sort Method: quicksort @@ -539,21 +539,22 @@ ORDER BY time; Sort Key: nd.node Sort Method: quicksort -> Seq Scan on nodetime nd (actual rows=1 loops=1) - -> Sort (actual rows=1250 loops=1) - Sort Key: mt_1.device_id - Sort Method: quicksort - -> Append (actual rows=1541 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) -(25 rows) + -> Materialize (actual rows=1250 loops=1) + -> Sort (actual rows=1250 loops=1) + Sort Key: mt_1.device_id + Sort Method: quicksort + -> Append (actual rows=1541 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk mt_1 (actual rows=480 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk mt_2 (actual rows=960 loops=1) + -> Seq Scan on compress_hyper_2_7_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk mt_3 (actual rows=48 loops=1) + -> Seq Scan on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk mt_4 (actual rows=48 loops=1) + -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk mt_5 (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_2_10_chunk (actual rows=5 loops=1) +(26 rows) SET enable_mergejoin = FALSE; SET enable_hashjoin = TRUE; @@ -619,7 +620,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=47 loops=2) Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) Rows Removed by Filter: 1 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=2) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=2) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (9 rows) @@ -641,7 +642,7 @@ WHERE met.time > '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND ("time" < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone) AND (v0 = 5)) Rows Removed by Filter: 47 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) Filter: ((_ts_meta_max_1 > 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_min_1 < 'Thu Jan 20 17:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -663,7 +664,7 @@ WHERE met.time = '2000-01-19 19:00:00-05' -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk met (actual rows=0 loops=1) Vectorized Filter: ((v0 = 5) AND ("time" = 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) Rows Removed by Filter: 48 - -> Index Scan using compress_hyper_2_8_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_8_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=1 loops=1) Index Cond: ((device_id = 3) AND (device_id_peer = 3)) Filter: ((_ts_meta_min_1 <= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Wed Jan 19 16:00:00 2000 PST'::timestamp with time zone)) (10 rows) @@ -689,7 +690,7 @@ ON met.device_id = q.node and met.device_id_peer = q.device_id_peer -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk met (actual rows=1 loops=1) Vectorized Filter: ((v0 > 2) AND ("time" = 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) Rows Removed by Filter: 47 - -> Index Scan using compress_hyper_2_9_chunk__compressed_hypertable_2_device_id_dev on compress_hyper_2_9_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) Filter: ((_ts_meta_min_1 <= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Jan 19 17:00:00 2018 PST'::timestamp with time zone)) (12 rows) @@ -789,8 +790,8 @@ ORDER BY 1, 2, 3, 4; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Sort (actual rows=10 loops=1) Sort Key: metrics_ordered_idx."time", metrics_ordered_idx.device_id, metrics_ordered_idx.device_id_peer, metrics_ordered_idx.v0 Sort Method: quicksort @@ -802,20 +803,15 @@ ORDER BY 1, Sort Key: _hyper_1_4_chunk."time" DESC -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk (actual rows=9 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_9_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) + -> Index Scan Backward using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk (actual rows=1 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND ("time" < now())) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_2_10_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) AND (device_id = 4) AND (device_id_peer = 5)) - Rows Removed by Filter: 4 -(24 rows) + -> Index Scan Backward using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: ((device_id = 4) AND (device_id_peer = 5)) + Filter: (_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2002 PST'::timestamp with time zone) +(19 rows) :PREFIX SELECT m.device_id, @@ -843,7 +839,7 @@ ORDER BY 1, Group Key: m.device_id, d.v0 Batches: 1 -> Hash Join (actual rows=0 loops=1) - Hash Cond: ((d.device_id = m.device_id) AND (d."time" = m."time")) + Hash Cond: ((m.device_id = d.device_id) AND (m."time" = d."time")) -> Custom Scan (ConstraintAwareAppend) (actual rows=0 loops=1) Hypertable: metrics_ordered_idx Chunks excluded during startup: 2 @@ -955,10 +951,9 @@ ORDER BY m.v0; -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) Rows Removed by Filter: 5 - -> Hash (actual rows=7 loops=1) - Buckets: 1024 Batches: 1 - -> Seq Scan on device_tbl d (actual rows=7 loops=1) -(13 rows) + -> Hash (never executed) + -> Seq Scan on device_tbl d (never executed) +(12 rows) -- no matches in metrics_ordered_idx but one row in device_tbl :PREFIX @@ -970,8 +965,8 @@ FROM device_tbl d AND m.time < '2000-01-01 0:00:00+0'::text::timestamptz WHERE d.device_id = 8 ORDER BY m.v0; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=1 loops=1) Sort Key: m.v0 Sort Method: quicksort @@ -981,9 +976,9 @@ ORDER BY m.v0; Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m (actual rows=0 loops=1) Vectorized Filter: (("time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND ("time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=0 loops=1) - Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (device_id = 8) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - Rows Removed by Filter: 5 + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 8) + Filter: ((_ts_meta_max_1 > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (_ts_meta_min_1 < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) (12 rows) -- no matches in device_tbl but 1 row in metrics_ordered_idx @@ -996,52 +991,34 @@ FROM device_tbl d AND m.time < '2000-01-01 0:00:00+0'::text::timestamptz WHERE m.device_id = 7 ORDER BY m.v0; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop Left Join (actual rows=1 loops=1) - Join Filter: ((m_1."time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (m_1."time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) - -> Merge Append (actual rows=1 loops=1) - Sort Key: m_1.v0 - -> Sort (actual rows=0 loops=1) - Sort Key: m_1.v0 - Sort Method: quicksort + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=1 loops=1) + Sort Key: m_1.v0 + Sort Method: quicksort + -> Nested Loop Left Join (actual rows=1 loops=1) + Join Filter: ((m_1."time" > 'Tue Jan 01 00:00:00 2019 PST'::timestamp with time zone) AND (m_1."time" < ('2000-01-01 0:00:00+0'::cstring)::timestamp with time zone)) + -> Append (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 - -> Sort (actual rows=0 loops=1) - Sort Key: m_2.v0 - Sort Method: quicksort + -> Index Scan using compress_hyper_2_6_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_6_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk m_2 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 5 - -> Sort (actual rows=0 loops=1) - Sort Key: m_3.v0 - Sort Method: quicksort + -> Index Scan using compress_hyper_2_7_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 - -> Sort (actual rows=0 loops=1) - Sort Key: m_4.v0 - Sort Method: quicksort + -> Index Scan using compress_hyper_2_8_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_4_chunk m_4 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 1 - -> Sort (actual rows=1 loops=1) - Sort Key: m_5.v0 - Sort Method: quicksort + -> Index Scan using compress_hyper_2_9_chunk_device_id_device_id_peer__ts_meta__idx on compress_hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id = 7) -> Custom Scan (DecompressChunk) on _hyper_1_5_chunk m_5 (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_2_10_chunk (actual rows=1 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 4 - -> Materialize (actual rows=0 loops=1) - -> Seq Scan on device_tbl d (actual rows=0 loops=1) - Filter: (device_id = 7) - Rows Removed by Filter: 7 -(43 rows) + -> Index Scan using compress_hyper_2_10_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_2_10_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 7) + -> Materialize (actual rows=0 loops=1) + -> Seq Scan on device_tbl d (actual rows=0 loops=1) + Filter: (device_id = 7) + Rows Removed by Filter: 7 +(25 rows) SET timescaledb.enable_chunk_append TO TRUE; -- github bug 2917 with UNION ALL that references compressed ht diff --git a/tsl/test/expected/transparent_decompression_queries.out b/tsl/test/expected/transparent_decompression_queries.out index 625a758ee9f..1da8e30ab8f 100644 --- a/tsl/test/expected/transparent_decompression_queries.out +++ b/tsl/test/expected/transparent_decompression_queries.out @@ -93,7 +93,7 @@ GROUP BY 2, 3; Sort Key: _hyper_3_5_chunk.device_id, _hyper_3_5_chunk.measure_id -> Custom Scan (DecompressChunk) on _hyper_3_5_chunk (actual rows=120 loops=1) Filter: ("time" < now()) - -> Index Scan using compress_hyper_4_10_chunk__compressed_hypertable_4_device_id_me on compress_hyper_4_10_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_4_10_chunk_device_id_measure_id__ts_meta_seq_idx on compress_hyper_4_10_chunk (actual rows=1 loops=1) -> Sort (actual rows=168 loops=1) Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id Sort Method: quicksort diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 4dc44ec41a7..e3a4bb4cf18 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -109,19 +109,19 @@ SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_11_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_11_chunk + -> Index Scan using compress_hyper_2_11_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_11_chunk Output: compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value, compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_12_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_12_chunk + -> Index Scan using compress_hyper_2_12_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_12_chunk Output: compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value, compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_13_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_13_chunk + -> Index Scan using compress_hyper_2_13_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_13_chunk Output: compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value, compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) -> Partial Aggregate @@ -174,7 +174,7 @@ SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_v -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.segment_by_value Vectorized Filter: (_hyper_1_1_chunk.int_value > 0) - -> Index Scan using compress_hyper_2_11_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_11_chunk + -> Index Scan using compress_hyper_2_11_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_11_chunk Output: compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value, compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) -> Partial Aggregate @@ -182,7 +182,7 @@ SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_v -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.segment_by_value Vectorized Filter: (_hyper_1_2_chunk.int_value > 0) - -> Index Scan using compress_hyper_2_12_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_12_chunk + -> Index Scan using compress_hyper_2_12_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_12_chunk Output: compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value, compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) -> Partial Aggregate @@ -190,7 +190,7 @@ SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_v -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.segment_by_value Vectorized Filter: (_hyper_1_3_chunk.int_value > 0) - -> Index Scan using compress_hyper_2_13_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_13_chunk + -> Index Scan using compress_hyper_2_13_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_13_chunk Output: compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value, compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) -> Partial Aggregate @@ -1770,61 +1770,61 @@ SELECT sum(int_value) FROM testtable WHERE segment_by_value > 5; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_41_chunk Output: (PARTIAL sum(_hyper_1_41_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_51_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_51_chunk + -> Index Scan using compress_hyper_2_51_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_51_chunk Output: compress_hyper_2_51_chunk."time", compress_hyper_2_51_chunk.segment_by_value, compress_hyper_2_51_chunk.int_value, compress_hyper_2_51_chunk.float_value, compress_hyper_2_51_chunk._ts_meta_count, compress_hyper_2_51_chunk._ts_meta_sequence_num, compress_hyper_2_51_chunk._ts_meta_min_1, compress_hyper_2_51_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_51_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_42_chunk Output: (PARTIAL sum(_hyper_1_42_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_52_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_52_chunk + -> Index Scan using compress_hyper_2_52_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_52_chunk Output: compress_hyper_2_52_chunk."time", compress_hyper_2_52_chunk.segment_by_value, compress_hyper_2_52_chunk.int_value, compress_hyper_2_52_chunk.float_value, compress_hyper_2_52_chunk._ts_meta_count, compress_hyper_2_52_chunk._ts_meta_sequence_num, compress_hyper_2_52_chunk._ts_meta_min_1, compress_hyper_2_52_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_52_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_43_chunk Output: (PARTIAL sum(_hyper_1_43_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_53_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_53_chunk + -> Index Scan using compress_hyper_2_53_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_53_chunk Output: compress_hyper_2_53_chunk."time", compress_hyper_2_53_chunk.segment_by_value, compress_hyper_2_53_chunk.int_value, compress_hyper_2_53_chunk.float_value, compress_hyper_2_53_chunk._ts_meta_count, compress_hyper_2_53_chunk._ts_meta_sequence_num, compress_hyper_2_53_chunk._ts_meta_min_1, compress_hyper_2_53_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_53_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_44_chunk Output: (PARTIAL sum(_hyper_1_44_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_54_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_54_chunk + -> Index Scan using compress_hyper_2_54_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_54_chunk Output: compress_hyper_2_54_chunk."time", compress_hyper_2_54_chunk.segment_by_value, compress_hyper_2_54_chunk.int_value, compress_hyper_2_54_chunk.float_value, compress_hyper_2_54_chunk._ts_meta_count, compress_hyper_2_54_chunk._ts_meta_sequence_num, compress_hyper_2_54_chunk._ts_meta_min_1, compress_hyper_2_54_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_54_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_45_chunk Output: (PARTIAL sum(_hyper_1_45_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_55_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_55_chunk + -> Index Scan using compress_hyper_2_55_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_55_chunk Output: compress_hyper_2_55_chunk."time", compress_hyper_2_55_chunk.segment_by_value, compress_hyper_2_55_chunk.int_value, compress_hyper_2_55_chunk.float_value, compress_hyper_2_55_chunk._ts_meta_count, compress_hyper_2_55_chunk._ts_meta_sequence_num, compress_hyper_2_55_chunk._ts_meta_min_1, compress_hyper_2_55_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_55_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_46_chunk Output: (PARTIAL sum(_hyper_1_46_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_56_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_56_chunk + -> Index Scan using compress_hyper_2_56_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_56_chunk Output: compress_hyper_2_56_chunk."time", compress_hyper_2_56_chunk.segment_by_value, compress_hyper_2_56_chunk.int_value, compress_hyper_2_56_chunk.float_value, compress_hyper_2_56_chunk._ts_meta_count, compress_hyper_2_56_chunk._ts_meta_sequence_num, compress_hyper_2_56_chunk._ts_meta_min_1, compress_hyper_2_56_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_56_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_47_chunk Output: (PARTIAL sum(_hyper_1_47_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_57_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_57_chunk + -> Index Scan using compress_hyper_2_57_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_57_chunk Output: compress_hyper_2_57_chunk."time", compress_hyper_2_57_chunk.segment_by_value, compress_hyper_2_57_chunk.int_value, compress_hyper_2_57_chunk.float_value, compress_hyper_2_57_chunk._ts_meta_count, compress_hyper_2_57_chunk._ts_meta_sequence_num, compress_hyper_2_57_chunk._ts_meta_min_1, compress_hyper_2_57_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_57_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_48_chunk Output: (PARTIAL sum(_hyper_1_48_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_58_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_58_chunk + -> Index Scan using compress_hyper_2_58_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_58_chunk Output: compress_hyper_2_58_chunk."time", compress_hyper_2_58_chunk.segment_by_value, compress_hyper_2_58_chunk.int_value, compress_hyper_2_58_chunk.float_value, compress_hyper_2_58_chunk._ts_meta_count, compress_hyper_2_58_chunk._ts_meta_sequence_num, compress_hyper_2_58_chunk._ts_meta_min_1, compress_hyper_2_58_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_58_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_49_chunk Output: (PARTIAL sum(_hyper_1_49_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_59_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_59_chunk + -> Index Scan using compress_hyper_2_59_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_59_chunk Output: compress_hyper_2_59_chunk."time", compress_hyper_2_59_chunk.segment_by_value, compress_hyper_2_59_chunk.int_value, compress_hyper_2_59_chunk.float_value, compress_hyper_2_59_chunk._ts_meta_count, compress_hyper_2_59_chunk._ts_meta_sequence_num, compress_hyper_2_59_chunk._ts_meta_min_1, compress_hyper_2_59_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_59_chunk.segment_by_value > 5) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_50_chunk Output: (PARTIAL sum(_hyper_1_50_chunk.int_value)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_2_60_chunk__compressed_hypertable_2_segment_by_v on _timescaledb_internal.compress_hyper_2_60_chunk + -> Index Scan using compress_hyper_2_60_chunk_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_60_chunk Output: compress_hyper_2_60_chunk."time", compress_hyper_2_60_chunk.segment_by_value, compress_hyper_2_60_chunk.int_value, compress_hyper_2_60_chunk.float_value, compress_hyper_2_60_chunk._ts_meta_count, compress_hyper_2_60_chunk._ts_meta_sequence_num, compress_hyper_2_60_chunk._ts_meta_min_1, compress_hyper_2_60_chunk._ts_meta_max_1 Index Cond: (compress_hyper_2_60_chunk.segment_by_value > 5) (63 rows) @@ -2444,61 +2444,61 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0; -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: (PARTIAL sum(_hyper_3_101_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_111_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_111_chunk + -> Index Scan using compress_hyper_4_111_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_111_chunk Output: compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value, compress_hyper_4_111_chunk._ts_meta_count, compress_hyper_4_111_chunk._ts_meta_sequence_num, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_111_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: (PARTIAL sum(_hyper_3_102_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_112_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_112_chunk + -> Index Scan using compress_hyper_4_112_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_112_chunk Output: compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value, compress_hyper_4_112_chunk._ts_meta_count, compress_hyper_4_112_chunk._ts_meta_sequence_num, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_112_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: (PARTIAL sum(_hyper_3_103_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_113_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_113_chunk + -> Index Scan using compress_hyper_4_113_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_113_chunk Output: compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value, compress_hyper_4_113_chunk._ts_meta_count, compress_hyper_4_113_chunk._ts_meta_sequence_num, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_113_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: (PARTIAL sum(_hyper_3_104_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_114_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_114_chunk + -> Index Scan using compress_hyper_4_114_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_114_chunk Output: compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value, compress_hyper_4_114_chunk._ts_meta_count, compress_hyper_4_114_chunk._ts_meta_sequence_num, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_114_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: (PARTIAL sum(_hyper_3_105_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_115_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_115_chunk + -> Index Scan using compress_hyper_4_115_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_115_chunk Output: compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value, compress_hyper_4_115_chunk._ts_meta_count, compress_hyper_4_115_chunk._ts_meta_sequence_num, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_115_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: (PARTIAL sum(_hyper_3_106_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_116_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_116_chunk + -> Index Scan using compress_hyper_4_116_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_116_chunk Output: compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value, compress_hyper_4_116_chunk._ts_meta_count, compress_hyper_4_116_chunk._ts_meta_sequence_num, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_116_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: (PARTIAL sum(_hyper_3_107_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_117_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_117_chunk + -> Index Scan using compress_hyper_4_117_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_117_chunk Output: compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value, compress_hyper_4_117_chunk._ts_meta_count, compress_hyper_4_117_chunk._ts_meta_sequence_num, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_117_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: (PARTIAL sum(_hyper_3_108_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_118_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_118_chunk + -> Index Scan using compress_hyper_4_118_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_118_chunk Output: compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value, compress_hyper_4_118_chunk._ts_meta_count, compress_hyper_4_118_chunk._ts_meta_sequence_num, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_118_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: (PARTIAL sum(_hyper_3_109_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_119_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_119_chunk + -> Index Scan using compress_hyper_4_119_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_119_chunk Output: compress_hyper_4_119_chunk."time", compress_hyper_4_119_chunk.segment_by_value1, compress_hyper_4_119_chunk.segment_by_value2, compress_hyper_4_119_chunk.int_value, compress_hyper_4_119_chunk.float_value, compress_hyper_4_119_chunk._ts_meta_count, compress_hyper_4_119_chunk._ts_meta_sequence_num, compress_hyper_4_119_chunk._ts_meta_min_1, compress_hyper_4_119_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_119_chunk.segment_by_value1 > 0) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_110_chunk Output: (PARTIAL sum(_hyper_3_110_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_120_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_120_chunk + -> Index Scan using compress_hyper_4_120_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_120_chunk Output: compress_hyper_4_120_chunk."time", compress_hyper_4_120_chunk.segment_by_value1, compress_hyper_4_120_chunk.segment_by_value2, compress_hyper_4_120_chunk.int_value, compress_hyper_4_120_chunk.float_value, compress_hyper_4_120_chunk._ts_meta_count, compress_hyper_4_120_chunk._ts_meta_sequence_num, compress_hyper_4_120_chunk._ts_meta_min_1, compress_hyper_4_120_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_120_chunk.segment_by_value1 > 0) (63 rows) @@ -2513,61 +2513,61 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: (PARTIAL sum(_hyper_3_101_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_111_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_111_chunk + -> Index Scan using compress_hyper_4_111_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_111_chunk Output: compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value, compress_hyper_4_111_chunk._ts_meta_count, compress_hyper_4_111_chunk._ts_meta_sequence_num, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: (PARTIAL sum(_hyper_3_102_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_112_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_112_chunk + -> Index Scan using compress_hyper_4_112_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_112_chunk Output: compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value, compress_hyper_4_112_chunk._ts_meta_count, compress_hyper_4_112_chunk._ts_meta_sequence_num, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: (PARTIAL sum(_hyper_3_103_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_113_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_113_chunk + -> Index Scan using compress_hyper_4_113_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_113_chunk Output: compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value, compress_hyper_4_113_chunk._ts_meta_count, compress_hyper_4_113_chunk._ts_meta_sequence_num, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: (PARTIAL sum(_hyper_3_104_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_114_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_114_chunk + -> Index Scan using compress_hyper_4_114_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_114_chunk Output: compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value, compress_hyper_4_114_chunk._ts_meta_count, compress_hyper_4_114_chunk._ts_meta_sequence_num, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: (PARTIAL sum(_hyper_3_105_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_115_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_115_chunk + -> Index Scan using compress_hyper_4_115_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_115_chunk Output: compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value, compress_hyper_4_115_chunk._ts_meta_count, compress_hyper_4_115_chunk._ts_meta_sequence_num, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: (PARTIAL sum(_hyper_3_106_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_116_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_116_chunk + -> Index Scan using compress_hyper_4_116_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_116_chunk Output: compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value, compress_hyper_4_116_chunk._ts_meta_count, compress_hyper_4_116_chunk._ts_meta_sequence_num, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: (PARTIAL sum(_hyper_3_107_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_117_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_117_chunk + -> Index Scan using compress_hyper_4_117_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_117_chunk Output: compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value, compress_hyper_4_117_chunk._ts_meta_count, compress_hyper_4_117_chunk._ts_meta_sequence_num, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: (PARTIAL sum(_hyper_3_108_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_118_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_118_chunk + -> Index Scan using compress_hyper_4_118_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_118_chunk Output: compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value, compress_hyper_4_118_chunk._ts_meta_count, compress_hyper_4_118_chunk._ts_meta_sequence_num, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: (PARTIAL sum(_hyper_3_109_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_119_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_119_chunk + -> Index Scan using compress_hyper_4_119_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_119_chunk Output: compress_hyper_4_119_chunk."time", compress_hyper_4_119_chunk.segment_by_value1, compress_hyper_4_119_chunk.segment_by_value2, compress_hyper_4_119_chunk.int_value, compress_hyper_4_119_chunk.float_value, compress_hyper_4_119_chunk._ts_meta_count, compress_hyper_4_119_chunk._ts_meta_sequence_num, compress_hyper_4_119_chunk._ts_meta_min_1, compress_hyper_4_119_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_119_chunk.segment_by_value1 > 0) AND (compress_hyper_4_119_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_110_chunk Output: (PARTIAL sum(_hyper_3_110_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_120_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_120_chunk + -> Index Scan using compress_hyper_4_120_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_120_chunk Output: compress_hyper_4_120_chunk."time", compress_hyper_4_120_chunk.segment_by_value1, compress_hyper_4_120_chunk.segment_by_value2, compress_hyper_4_120_chunk.int_value, compress_hyper_4_120_chunk.float_value, compress_hyper_4_120_chunk._ts_meta_count, compress_hyper_4_120_chunk._ts_meta_sequence_num, compress_hyper_4_120_chunk._ts_meta_min_1, compress_hyper_4_120_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_120_chunk.segment_by_value1 > 0) AND (compress_hyper_4_120_chunk.segment_by_value2 > 0)) (63 rows) @@ -2582,61 +2582,61 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: (PARTIAL sum(_hyper_3_101_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_111_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_111_chunk + -> Index Scan using compress_hyper_4_111_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_111_chunk Output: compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value, compress_hyper_4_111_chunk._ts_meta_count, compress_hyper_4_111_chunk._ts_meta_sequence_num, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: (PARTIAL sum(_hyper_3_102_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_112_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_112_chunk + -> Index Scan using compress_hyper_4_112_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_112_chunk Output: compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value, compress_hyper_4_112_chunk._ts_meta_count, compress_hyper_4_112_chunk._ts_meta_sequence_num, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: (PARTIAL sum(_hyper_3_103_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_113_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_113_chunk + -> Index Scan using compress_hyper_4_113_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_113_chunk Output: compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value, compress_hyper_4_113_chunk._ts_meta_count, compress_hyper_4_113_chunk._ts_meta_sequence_num, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: (PARTIAL sum(_hyper_3_104_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_114_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_114_chunk + -> Index Scan using compress_hyper_4_114_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_114_chunk Output: compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value, compress_hyper_4_114_chunk._ts_meta_count, compress_hyper_4_114_chunk._ts_meta_sequence_num, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: (PARTIAL sum(_hyper_3_105_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_115_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_115_chunk + -> Index Scan using compress_hyper_4_115_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_115_chunk Output: compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value, compress_hyper_4_115_chunk._ts_meta_count, compress_hyper_4_115_chunk._ts_meta_sequence_num, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: (PARTIAL sum(_hyper_3_106_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_116_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_116_chunk + -> Index Scan using compress_hyper_4_116_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_116_chunk Output: compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value, compress_hyper_4_116_chunk._ts_meta_count, compress_hyper_4_116_chunk._ts_meta_sequence_num, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: (PARTIAL sum(_hyper_3_107_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_117_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_117_chunk + -> Index Scan using compress_hyper_4_117_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_117_chunk Output: compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value, compress_hyper_4_117_chunk._ts_meta_count, compress_hyper_4_117_chunk._ts_meta_sequence_num, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: (PARTIAL sum(_hyper_3_108_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_118_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_118_chunk + -> Index Scan using compress_hyper_4_118_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_118_chunk Output: compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value, compress_hyper_4_118_chunk._ts_meta_count, compress_hyper_4_118_chunk._ts_meta_sequence_num, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: (PARTIAL sum(_hyper_3_109_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_119_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_119_chunk + -> Index Scan using compress_hyper_4_119_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_119_chunk Output: compress_hyper_4_119_chunk."time", compress_hyper_4_119_chunk.segment_by_value1, compress_hyper_4_119_chunk.segment_by_value2, compress_hyper_4_119_chunk.int_value, compress_hyper_4_119_chunk.float_value, compress_hyper_4_119_chunk._ts_meta_count, compress_hyper_4_119_chunk._ts_meta_sequence_num, compress_hyper_4_119_chunk._ts_meta_min_1, compress_hyper_4_119_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_119_chunk.segment_by_value1 > 0) AND (compress_hyper_4_119_chunk.segment_by_value2 > 0)) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_110_chunk Output: (PARTIAL sum(_hyper_3_110_chunk.segment_by_value1)) Vectorized Aggregation: true - -> Index Scan using compress_hyper_4_120_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_120_chunk + -> Index Scan using compress_hyper_4_120_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_120_chunk Output: compress_hyper_4_120_chunk."time", compress_hyper_4_120_chunk.segment_by_value1, compress_hyper_4_120_chunk.segment_by_value2, compress_hyper_4_120_chunk.int_value, compress_hyper_4_120_chunk.float_value, compress_hyper_4_120_chunk._ts_meta_count, compress_hyper_4_120_chunk._ts_meta_sequence_num, compress_hyper_4_120_chunk._ts_meta_min_1, compress_hyper_4_120_chunk._ts_meta_max_1 Index Cond: ((compress_hyper_4_120_chunk.segment_by_value1 > 0) AND (compress_hyper_4_120_chunk.segment_by_value2 > 0)) (63 rows) @@ -2656,7 +2656,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: _hyper_3_101_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_101_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_111_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_111_chunk + -> Index Scan using compress_hyper_4_111_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_111_chunk Output: compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value, compress_hyper_4_111_chunk._ts_meta_count, compress_hyper_4_111_chunk._ts_meta_sequence_num, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_111_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2664,7 +2664,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: _hyper_3_102_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_102_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_112_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_112_chunk + -> Index Scan using compress_hyper_4_112_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_112_chunk Output: compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value, compress_hyper_4_112_chunk._ts_meta_count, compress_hyper_4_112_chunk._ts_meta_sequence_num, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_112_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2672,7 +2672,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: _hyper_3_103_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_103_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_113_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_113_chunk + -> Index Scan using compress_hyper_4_113_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_113_chunk Output: compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value, compress_hyper_4_113_chunk._ts_meta_count, compress_hyper_4_113_chunk._ts_meta_sequence_num, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_113_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2680,7 +2680,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: _hyper_3_104_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_104_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_114_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_114_chunk + -> Index Scan using compress_hyper_4_114_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_114_chunk Output: compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value, compress_hyper_4_114_chunk._ts_meta_count, compress_hyper_4_114_chunk._ts_meta_sequence_num, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_114_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2688,7 +2688,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: _hyper_3_105_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_105_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_115_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_115_chunk + -> Index Scan using compress_hyper_4_115_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_115_chunk Output: compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value, compress_hyper_4_115_chunk._ts_meta_count, compress_hyper_4_115_chunk._ts_meta_sequence_num, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_115_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2696,7 +2696,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: _hyper_3_106_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_106_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_116_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_116_chunk + -> Index Scan using compress_hyper_4_116_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_116_chunk Output: compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value, compress_hyper_4_116_chunk._ts_meta_count, compress_hyper_4_116_chunk._ts_meta_sequence_num, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_116_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2704,7 +2704,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: _hyper_3_107_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_107_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_117_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_117_chunk + -> Index Scan using compress_hyper_4_117_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_117_chunk Output: compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value, compress_hyper_4_117_chunk._ts_meta_count, compress_hyper_4_117_chunk._ts_meta_sequence_num, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_117_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2712,7 +2712,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: _hyper_3_108_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_108_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_118_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_118_chunk + -> Index Scan using compress_hyper_4_118_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_118_chunk Output: compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value, compress_hyper_4_118_chunk._ts_meta_count, compress_hyper_4_118_chunk._ts_meta_sequence_num, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_118_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2720,7 +2720,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: _hyper_3_109_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_109_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_119_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_119_chunk + -> Index Scan using compress_hyper_4_119_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_119_chunk Output: compress_hyper_4_119_chunk."time", compress_hyper_4_119_chunk.segment_by_value1, compress_hyper_4_119_chunk.segment_by_value2, compress_hyper_4_119_chunk.int_value, compress_hyper_4_119_chunk.float_value, compress_hyper_4_119_chunk._ts_meta_count, compress_hyper_4_119_chunk._ts_meta_sequence_num, compress_hyper_4_119_chunk._ts_meta_min_1, compress_hyper_4_119_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_119_chunk.segment_by_value1 > 1000) -> Partial Aggregate @@ -2728,7 +2728,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 1000 AND -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_110_chunk Output: _hyper_3_110_chunk.segment_by_value1 Vectorized Filter: (_hyper_3_110_chunk.int_value > 1000) - -> Index Scan using compress_hyper_4_120_chunk__compressed_hypertable_4_segment_by_ on _timescaledb_internal.compress_hyper_4_120_chunk + -> Index Scan using compress_hyper_4_120_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_120_chunk Output: compress_hyper_4_120_chunk."time", compress_hyper_4_120_chunk.segment_by_value1, compress_hyper_4_120_chunk.segment_by_value2, compress_hyper_4_120_chunk.int_value, compress_hyper_4_120_chunk.float_value, compress_hyper_4_120_chunk._ts_meta_count, compress_hyper_4_120_chunk._ts_meta_sequence_num, compress_hyper_4_120_chunk._ts_meta_min_1, compress_hyper_4_120_chunk._ts_meta_max_1 Index Cond: (compress_hyper_4_120_chunk.segment_by_value1 > 1000) (83 rows) diff --git a/tsl/test/shared/expected/compat.out b/tsl/test/shared/expected/compat.out index 3886b4fc614..94603710822 100644 --- a/tsl/test/shared/expected/compat.out +++ b/tsl/test/shared/expected/compat.out @@ -121,9 +121,6 @@ WARNING: function _timescaledb_internal.get_partition_hash(anyelement) is depre (1 row) -SELECT _timescaledb_internal.hypertable_constraint_add_table_fk_constraint(NULL,NULL,NULL,0); -WARNING: function _timescaledb_internal.hypertable_constraint_add_table_fk_constraint(name,name,name,integer) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version. -ERROR: query returned no rows SELECT _timescaledb_internal.hypertable_invalidation_log_delete(0); WARNING: function _timescaledb_internal.hypertable_invalidation_log_delete(integer) is deprecated and has been moved to _timescaledb_functions schema. this compatibility function will be removed in a future version. hypertable_invalidation_log_delete diff --git a/tsl/test/shared/expected/compression_dml.out b/tsl/test/shared/expected/compression_dml.out index bdde8614002..55a467763d1 100644 --- a/tsl/test/shared/expected/compression_dml.out +++ b/tsl/test/shared/expected/compression_dml.out @@ -101,7 +101,6 @@ QUERY PLAN (4 rows) DROP TABLE mytab CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_X_X_chunk -- test varchar segmentby CREATE TABLE comp_seg_varchar ( time timestamptz NOT NULL, diff --git a/tsl/test/shared/expected/constify_timestamptz_op_interval.out b/tsl/test/shared/expected/constify_timestamptz_op_interval.out index 4c6eaf82dcd..1fec893c1dd 100644 --- a/tsl/test/shared/expected/constify_timestamptz_op_interval.out +++ b/tsl/test/shared/expected/constify_timestamptz_op_interval.out @@ -136,9 +136,10 @@ WHERE time < '2000-01-01'::timestamptz - '6h'::interval QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk Vectorized Filter: ("time" < ('Sat Jan 01 00:00:00 2000 PST'::timestamp with time zone - '@ 6 hours'::interval)) - -> Seq Scan on compress_hyper_X_X_chunk - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('Sat Jan 01 00:00:00 2000 PST'::timestamp with time zone - '@ 6 hours'::interval))) -(4 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('Sat Jan 01 00:00:00 2000 PST'::timestamp with time zone - '@ 6 hours'::interval)) +(5 rows) -- month/year intervals are not constified :PREFIX diff --git a/tsl/test/shared/expected/constraint_exclusion_prepared.out b/tsl/test/shared/expected/constraint_exclusion_prepared.out index 9842725e129..690dd5dca17 100644 --- a/tsl/test/shared/expected/constraint_exclusion_prepared.out +++ b/tsl/test/shared/expected/constraint_exclusion_prepared.out @@ -1483,15 +1483,15 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (16 rows) @@ -1503,15 +1503,15 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (16 rows) @@ -1523,15 +1523,15 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (16 rows) @@ -1543,15 +1543,15 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (16 rows) @@ -1563,15 +1563,15 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (16 rows) @@ -1592,12 +1592,12 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) (14 rows) @@ -1610,12 +1610,12 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) (14 rows) @@ -1628,12 +1628,12 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) (14 rows) @@ -1646,12 +1646,12 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) (14 rows) @@ -1664,12 +1664,12 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) (14 rows) @@ -1696,13 +1696,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100) @@ -1730,13 +1730,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100) @@ -1764,13 +1764,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100) @@ -1798,13 +1798,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100) @@ -1832,13 +1832,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_compressed m2 (actual rows=1 loops=100) @@ -2201,24 +2201,17 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(23 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(16 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2228,24 +2221,17 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(23 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(16 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2255,24 +2241,17 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(23 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(16 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2282,24 +2261,17 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(23 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(16 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2309,24 +2281,17 @@ QUERY PLAN Chunks excluded during startup: 0 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < now()) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < now()) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(23 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(16 rows) DEALLOCATE prep; -- executor startup exclusion with chunks excluded @@ -2345,18 +2310,15 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) -(17 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) +(14 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2366,18 +2328,15 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) -(17 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) +(14 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2387,18 +2346,15 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) -(17 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) +(14 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2408,18 +2364,15 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) -(17 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) +(14 rows) :PREFIX EXECUTE prep; QUERY PLAN @@ -2429,18 +2382,15 @@ QUERY PLAN Chunks excluded during startup: 1 -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=100 loops=1) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) Vectorized Filter: ("time" < ('2000-01-10'::cstring)::timestamp with time zone) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: ((device_id = 1) AND (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone)) -(17 rows) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) + Filter: (_ts_meta_min_1 < ('2000-01-10'::cstring)::timestamp with time zone) +(14 rows) DEALLOCATE prep; -- runtime exclusion with LATERAL and 2 hypertables @@ -2464,13 +2414,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100) @@ -2522,13 +2472,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100) @@ -2580,13 +2530,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100) @@ -2638,13 +2588,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100) @@ -2696,13 +2646,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed m1 (actual rows=100 loops=1) Order: m1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Limit (actual rows=1 loops=100) -> Custom Scan (ChunkAppend) on metrics_space_compressed m2 (actual rows=1 loops=100) diff --git a/tsl/test/shared/expected/extension.out b/tsl/test/shared/expected/extension.out index 63bbebb935a..957a819814d 100644 --- a/tsl/test/shared/expected/extension.out +++ b/tsl/test/shared/expected/extension.out @@ -53,6 +53,7 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text _timescaledb_functions.compressed_data_out(_timescaledb_internal.compressed_data) _timescaledb_functions.compressed_data_recv(internal) _timescaledb_functions.compressed_data_send(_timescaledb_internal.compressed_data) + _timescaledb_functions.constraint_clone(oid,regclass) _timescaledb_functions.continuous_agg_invalidation_trigger() _timescaledb_functions.create_chunk(regclass,jsonb,name,name,regclass) _timescaledb_functions.create_chunk_table(regclass,jsonb,name,name) @@ -81,7 +82,6 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text _timescaledb_functions.hist_finalfunc(internal,double precision,double precision,double precision,integer) _timescaledb_functions.hist_serializefunc(internal) _timescaledb_functions.hist_sfunc(internal,double precision,double precision,double precision,integer) - _timescaledb_functions.hypertable_constraint_add_table_fk_constraint(name,name,name,integer) _timescaledb_functions.hypertable_invalidation_log_delete(integer) _timescaledb_functions.hypertable_local_size(name,name) _timescaledb_functions.hypertable_osm_range_update(regclass,anyelement,anyelement,boolean) @@ -174,7 +174,6 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text _timescaledb_internal.get_os_info() _timescaledb_internal.get_partition_for_key(anyelement) _timescaledb_internal.get_partition_hash(anyelement) - _timescaledb_internal.hypertable_constraint_add_table_fk_constraint(name,name,name,integer) _timescaledb_internal.hypertable_invalidation_log_delete(integer) _timescaledb_internal.hypertable_local_size(name,name) _timescaledb_internal.indexes_local_size(name,name) diff --git a/tsl/test/shared/expected/ordered_append-13.out b/tsl/test/shared/expected/ordered_append-13.out index b154abcded8..3d36979bd79 100644 --- a/tsl/test/shared/expected/ordered_append-13.out +++ b/tsl/test/shared/expected/ordered_append-13.out @@ -2189,13 +2189,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2214,13 +2214,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2260,21 +2260,12 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(9 rows) -- time column must be primary sort order :PREFIX @@ -2293,24 +2284,21 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(24 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(21 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -2328,13 +2316,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -2346,30 +2334,20 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_compressed (actual rows=27348 loops=1) - Order: metrics_compressed."time" - -> Sort (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(23 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(13 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -2717,18 +2695,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2791,18 +2766,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -2883,17 +2855,17 @@ QUERY PLAN Order: metrics_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -3281,22 +3253,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test RECORD in targetlist :PREFIX @@ -3313,22 +3278,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test sort column not in targetlist :PREFIX @@ -3398,51 +3356,24 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) -(48 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(21 rows) -- time column must be primary sort order :PREFIX @@ -3461,42 +3392,39 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(42 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(39 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -3514,13 +3442,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -3532,54 +3460,29 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=27348 loops=1) - Order: metrics_space_compressed."time" - -> Merge Append (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(47 rows) + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(22 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -4385,27 +4288,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4492,27 +4392,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -4667,17 +4564,17 @@ QUERY PLAN Order: metrics_space_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) diff --git a/tsl/test/shared/expected/ordered_append-14.out b/tsl/test/shared/expected/ordered_append-14.out index b154abcded8..3d36979bd79 100644 --- a/tsl/test/shared/expected/ordered_append-14.out +++ b/tsl/test/shared/expected/ordered_append-14.out @@ -2189,13 +2189,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2214,13 +2214,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2260,21 +2260,12 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(9 rows) -- time column must be primary sort order :PREFIX @@ -2293,24 +2284,21 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(24 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(21 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -2328,13 +2316,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -2346,30 +2334,20 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_compressed (actual rows=27348 loops=1) - Order: metrics_compressed."time" - -> Sort (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(23 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(13 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -2717,18 +2695,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2791,18 +2766,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -2883,17 +2855,17 @@ QUERY PLAN Order: metrics_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -3281,22 +3253,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test RECORD in targetlist :PREFIX @@ -3313,22 +3278,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test sort column not in targetlist :PREFIX @@ -3398,51 +3356,24 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) -(48 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(21 rows) -- time column must be primary sort order :PREFIX @@ -3461,42 +3392,39 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(42 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(39 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -3514,13 +3442,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -3532,54 +3460,29 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=27348 loops=1) - Order: metrics_space_compressed."time" - -> Merge Append (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(47 rows) + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(22 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -4385,27 +4288,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4492,27 +4392,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -4667,17 +4564,17 @@ QUERY PLAN Order: metrics_space_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) diff --git a/tsl/test/shared/expected/ordered_append-15.out b/tsl/test/shared/expected/ordered_append-15.out index 2f50430d901..31ae8475a62 100644 --- a/tsl/test/shared/expected/ordered_append-15.out +++ b/tsl/test/shared/expected/ordered_append-15.out @@ -2208,13 +2208,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2234,13 +2234,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (13 rows) @@ -2281,21 +2281,12 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(9 rows) -- time column must be primary sort order :PREFIX @@ -2314,24 +2305,21 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(24 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(21 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -2349,13 +2337,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -2367,30 +2355,20 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_compressed (actual rows=27348 loops=1) - Order: metrics_compressed."time" - -> Sort (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(23 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(13 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -2741,18 +2719,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2815,18 +2790,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -2907,17 +2879,17 @@ QUERY PLAN Order: metrics_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -3306,22 +3278,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test RECORD in targetlist :PREFIX @@ -3339,22 +3304,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(20 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(13 rows) -- test sort column not in targetlist :PREFIX @@ -3425,51 +3383,24 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) -(48 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(21 rows) -- time column must be primary sort order :PREFIX @@ -3488,42 +3419,39 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(42 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(39 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -3541,13 +3469,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -3559,54 +3487,29 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=27348 loops=1) - Order: metrics_space_compressed."time" - -> Merge Append (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(47 rows) + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(22 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -4415,27 +4318,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4522,27 +4422,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -4697,17 +4594,17 @@ QUERY PLAN Order: metrics_space_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) diff --git a/tsl/test/shared/expected/ordered_append-16.out b/tsl/test/shared/expected/ordered_append-16.out index 2f50430d901..31ae8475a62 100644 --- a/tsl/test/shared/expected/ordered_append-16.out +++ b/tsl/test/shared/expected/ordered_append-16.out @@ -2208,13 +2208,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2234,13 +2234,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (13 rows) @@ -2281,21 +2281,12 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(9 rows) -- time column must be primary sort order :PREFIX @@ -2314,24 +2305,21 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(24 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(21 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -2349,13 +2337,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -2367,30 +2355,20 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_compressed (actual rows=27348 loops=1) - Order: metrics_compressed."time" - -> Sort (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 - -> Sort (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(23 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(13 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -2741,18 +2719,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2815,18 +2790,15 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10076 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 18 -(18 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(15 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -2907,17 +2879,17 @@ QUERY PLAN Order: metrics_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -3306,22 +3278,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test RECORD in targetlist :PREFIX @@ -3339,22 +3304,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(20 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(13 rows) -- test sort column not in targetlist :PREFIX @@ -3425,51 +3383,24 @@ QUERY PLAN -> Merge Append (actual rows=1 loops=1) Sort Key: _hyper_X_X_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) -(48 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) +(21 rows) -- time column must be primary sort order :PREFIX @@ -3488,42 +3419,39 @@ QUERY PLAN -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk._ts_meta_sequence_num DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(42 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(39 rows) -- test equality constraint on ORDER BY prefix -- currently not optimized @@ -3541,13 +3469,13 @@ QUERY PLAN -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_X_X_chunk."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (12 rows) @@ -3559,54 +3487,29 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time ASC; QUERY PLAN - Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=27348 loops=1) - Order: metrics_space_compressed."time" - -> Merge Append (actual rows=7196 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=3598 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 - -> Merge Append (actual rows=10076 loops=1) - Sort Key: _hyper_X_X_chunk."time" - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=5038 loops=1) - Sort Key: _hyper_X_X_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(47 rows) + Sort (actual rows=27348 loops=1) + Sort Key: _hyper_X_X_chunk."time" + Sort Method: quicksort + -> Append (actual rows=27348 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(22 rows) -- queries without ORDER BY shouldnt use ordered append :PREFIX @@ -4415,27 +4318,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4522,27 +4422,24 @@ QUERY PLAN -> Result (actual rows=27348 loops=1) -> Append (actual rows=27348 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 8 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(27 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(24 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -4697,17 +4594,17 @@ QUERY PLAN Order: metrics_space_compressed."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (17 rows) diff --git a/tsl/test/shared/expected/ordered_append_join-13.out b/tsl/test/shared/expected/ordered_append_join-13.out index dcf6d20d941..abce183b222 100644 --- a/tsl/test/shared/expected/ordered_append_join-13.out +++ b/tsl/test/shared/expected/ordered_append_join-13.out @@ -1926,13 +1926,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2140,17 +2140,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -2158,17 +2158,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -2244,13 +2244,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -2299,25 +2299,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2338,25 +2338,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2396,25 +2396,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2435,25 +2435,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2474,25 +2474,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2514,25 +2514,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2553,25 +2553,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2593,21 +2593,21 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Sort (actual rows=100 loops=1) Sort Key: o2_1."time", o2_1.device_id Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) (23 rows) -- test JOIN on device_id @@ -2625,24 +2625,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) (24 rows) @@ -2664,25 +2664,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2705,13 +2705,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -2719,25 +2719,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (40 rows) @@ -2901,22 +2901,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test plan with best index is chosen -- this should use time index @@ -3417,17 +3410,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -3435,17 +3428,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -3583,13 +3576,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -3676,25 +3669,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3715,25 +3708,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3773,25 +3766,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3812,25 +3805,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3851,25 +3844,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3891,25 +3884,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3930,25 +3923,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3970,46 +3963,47 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) - -> Sort (actual rows=100 loops=1) - Sort Key: o2_1."time", o2_1.device_id - Sort Method: quicksort - -> Append (actual rows=68370 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) -(47 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Sort (actual rows=100 loops=1) + Sort Key: o2_1."time", o2_1.device_id + Sort Method: quicksort + -> Append (actual rows=68370 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) +(48 rows) -- test JOIN on device_id -- should not use ordered append for 2nd hypertable @@ -4026,24 +4020,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) (24 rows) @@ -4065,25 +4059,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -4106,13 +4100,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -4120,25 +4114,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (40 rows) diff --git a/tsl/test/shared/expected/ordered_append_join-14.out b/tsl/test/shared/expected/ordered_append_join-14.out index dcf6d20d941..abce183b222 100644 --- a/tsl/test/shared/expected/ordered_append_join-14.out +++ b/tsl/test/shared/expected/ordered_append_join-14.out @@ -1926,13 +1926,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2140,17 +2140,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -2158,17 +2158,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -2244,13 +2244,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -2299,25 +2299,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2338,25 +2338,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2396,25 +2396,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2435,25 +2435,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2474,25 +2474,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2514,25 +2514,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2553,25 +2553,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2593,21 +2593,21 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Sort (actual rows=100 loops=1) Sort Key: o2_1."time", o2_1.device_id Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) (23 rows) -- test JOIN on device_id @@ -2625,24 +2625,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) (24 rows) @@ -2664,25 +2664,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2705,13 +2705,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -2719,25 +2719,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (40 rows) @@ -2901,22 +2901,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test plan with best index is chosen -- this should use time index @@ -3417,17 +3410,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -3435,17 +3428,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -3583,13 +3576,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -3676,25 +3669,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3715,25 +3708,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3773,25 +3766,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3812,25 +3805,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3851,25 +3844,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3891,25 +3884,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3930,25 +3923,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3970,46 +3963,47 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) - -> Sort (actual rows=100 loops=1) - Sort Key: o2_1."time", o2_1.device_id - Sort Method: quicksort - -> Append (actual rows=68370 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) -(47 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Sort (actual rows=100 loops=1) + Sort Key: o2_1."time", o2_1.device_id + Sort Method: quicksort + -> Append (actual rows=68370 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) +(48 rows) -- test JOIN on device_id -- should not use ordered append for 2nd hypertable @@ -4026,24 +4020,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) (24 rows) @@ -4065,25 +4059,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -4106,13 +4100,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -4120,25 +4114,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (40 rows) diff --git a/tsl/test/shared/expected/ordered_append_join-15.out b/tsl/test/shared/expected/ordered_append_join-15.out index 2e5dcf4f357..a6eb39a81a3 100644 --- a/tsl/test/shared/expected/ordered_append_join-15.out +++ b/tsl/test/shared/expected/ordered_append_join-15.out @@ -1939,13 +1939,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2157,17 +2157,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -2175,17 +2175,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -2262,13 +2262,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -2317,25 +2317,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2356,25 +2356,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2414,25 +2414,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2453,25 +2453,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2492,25 +2492,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2532,25 +2532,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2571,25 +2571,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2611,21 +2611,21 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Sort (actual rows=100 loops=1) Sort Key: o2_1."time", o2_1.device_id Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) (23 rows) -- test JOIN on device_id @@ -2643,24 +2643,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) (24 rows) @@ -2682,25 +2682,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2723,13 +2723,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -2737,25 +2737,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (40 rows) @@ -2920,22 +2920,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test plan with best index is chosen -- this should use time index @@ -3440,17 +3433,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -3458,17 +3451,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -3607,13 +3600,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -3700,25 +3693,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3739,25 +3732,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3797,25 +3790,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3836,25 +3829,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3875,25 +3868,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3915,25 +3908,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3954,25 +3947,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3994,46 +3987,47 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) - -> Sort (actual rows=100 loops=1) - Sort Key: o2_1."time", o2_1.device_id - Sort Method: quicksort - -> Append (actual rows=68370 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) -(47 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Sort (actual rows=100 loops=1) + Sort Key: o2_1."time", o2_1.device_id + Sort Method: quicksort + -> Append (actual rows=68370 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) +(48 rows) -- test JOIN on device_id -- should not use ordered append for 2nd hypertable @@ -4050,24 +4044,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 1) (24 rows) @@ -4089,25 +4083,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -4130,13 +4124,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -4144,25 +4138,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (40 rows) diff --git a/tsl/test/shared/expected/ordered_append_join-16.out b/tsl/test/shared/expected/ordered_append_join-16.out index 47ee1c37f1e..6799539097b 100644 --- a/tsl/test/shared/expected/ordered_append_join-16.out +++ b/tsl/test/shared/expected/ordered_append_join-16.out @@ -1939,13 +1939,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) Order: metrics_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) (12 rows) @@ -2157,17 +2157,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -2175,17 +2175,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -2262,13 +2262,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -2317,25 +2317,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2356,25 +2356,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2414,25 +2414,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2453,25 +2453,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2492,25 +2492,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2532,25 +2532,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2571,25 +2571,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2611,21 +2611,21 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=30 loops=1) -> Sort (actual rows=100 loops=1) Sort Key: o2_1."time", o2_1.device_id Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=17990 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=20 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=25190 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=30 loops=1) (23 rows) -- test JOIN on device_id @@ -2643,24 +2643,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: ((device_id = 1) AND (device_id = 1)) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: ((device_id = 1) AND (device_id = 1)) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: ((device_id = 1) AND (device_id = 1)) (24 rows) @@ -2682,25 +2682,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (26 rows) @@ -2723,13 +2723,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -2737,25 +2737,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: (device_id = 2) (40 rows) @@ -2920,22 +2920,15 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) Order: metrics_space_compressed."time" DESC -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) - -> Sort (never executed) - Sort Key: compress_hyper_X_X_chunk._ts_meta_sequence_num - -> Seq Scan on compress_hyper_X_X_chunk (never executed) - Filter: (device_id = 1) -(19 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) + Index Cond: (device_id = 1) +(12 rows) -- test plan with best index is chosen -- this should use time index @@ -3440,17 +3433,17 @@ QUERY PLAN Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Materialize (actual rows=13674 loops=1) @@ -3458,17 +3451,17 @@ QUERY PLAN Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=5038 loops=1) Vectorized Filter: ("time" < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 2) Filter: (_ts_meta_min_1 < 'Tue Feb 01 00:00:00 2000 PST'::timestamp with time zone) (37 rows) @@ -3607,13 +3600,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=13674 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=5038 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) Index Cond: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: ($0) @@ -3700,25 +3693,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3739,25 +3732,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3797,25 +3790,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3836,25 +3829,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3875,25 +3868,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3915,25 +3908,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3954,25 +3947,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -3994,46 +3987,47 @@ QUERY PLAN Sort Method: quicksort -> Append (actual rows=68370 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=18 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=18 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=6 loops=1) - -> Sort (actual rows=100 loops=1) - Sort Key: o2_1."time", o2_1.device_id - Sort Method: quicksort - -> Append (actual rows=68370 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) -(47 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Sort (actual rows=100 loops=1) + Sort Key: o2_1."time", o2_1.device_id + Sort Method: quicksort + -> Append (actual rows=68370 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (actual rows=10794 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=12 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (actual rows=3598 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_4 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_5 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_6 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_7 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_8 (actual rows=15114 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_9 (actual rows=5038 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=6 loops=1) +(48 rows) -- test JOIN on device_id -- should not use ordered append for 2nd hypertable @@ -4050,24 +4044,24 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=1 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=1 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Append (actual rows=100 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=1 loops=1) Index Cond: ((device_id = 1) AND (device_id = 1)) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: ((device_id = 1) AND (device_id = 1)) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (never executed) Index Cond: ((device_id = 1) AND (device_id = 1)) (24 rows) @@ -4089,25 +4083,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (26 rows) @@ -4130,13 +4124,13 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o3 (actual rows=100 loops=1) Order: o3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o3_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 3) -> Materialize (actual rows=100 loops=1) -> Merge Join (actual rows=100 loops=1) @@ -4144,25 +4138,25 @@ QUERY PLAN -> Custom Scan (ChunkAppend) on metrics_space_compressed o1 (actual rows=100 loops=1) Order: o1."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o1_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 1) -> Materialize (actual rows=100 loops=1) -> Custom Scan (ChunkAppend) on metrics_space_compressed o2 (actual rows=100 loops=1) Order: o2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_1 (actual rows=100 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_2 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk o2_3 (never executed) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_6_device_id__t on compress_hyper_X_X_chunk (never executed) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (never executed) Index Cond: (device_id = 2) (40 rows) diff --git a/tsl/test/shared/expected/security_barrier.out b/tsl/test/shared/expected/security_barrier.out index 67c0aaab722..98e3a39c643 100644 --- a/tsl/test/shared/expected/security_barrier.out +++ b/tsl/test/shared/expected/security_barrier.out @@ -52,5 +52,4 @@ SELECT * FROM test_security_barrier_view; RESET ROLE; DROP TABLE test_security_barrier CASCADE; -NOTICE: drop cascades to table _timescaledb_internal.compress_hyper_X_X_chunk NOTICE: drop cascades to view test_security_barrier_view diff --git a/tsl/test/shared/expected/transparent_decompress_chunk-13.out b/tsl/test/shared/expected/transparent_decompress_chunk-13.out index c6aeb796f75..e08e7de6a01 100644 --- a/tsl/test/shared/expected/transparent_decompress_chunk-13.out +++ b/tsl/test/shared/expected/transparent_decompress_chunk-13.out @@ -5,6 +5,8 @@ \set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)' \set PREFIX_NO_ANALYZE 'EXPLAIN (verbose, costs off)' \set PREFIX_NO_VERBOSE 'EXPLAIN (costs off)' +SET parallel_leader_participation TO off; +SET min_parallel_table_scan_size TO '0'; SELECT show_chunks('metrics_compressed') AS "TEST_TABLE" ORDER BY 1::text LIMIT 1 \gset -- this should use DecompressChunk node :PREFIX_VERBOSE @@ -15,7 +17,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=5 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (8 rows) @@ -51,10 +53,9 @@ QUERY PLAN Sort Key: t."time", t.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk t (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(7 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(6 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; @@ -67,10 +68,9 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < 0; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 20 -(4 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(3 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; @@ -86,7 +86,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -97,7 +97,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -105,7 +105,7 @@ QUERY PLAN :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (3 rows) @@ -132,21 +132,22 @@ QUERY PLAN QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) -- test IS NULL / IS NOT NULL -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (device_id IS NOT NULL) -(7 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (device_id IS NOT NULL) +(8 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN @@ -155,7 +156,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) Index Cond: (device_id IS NULL) (7 rows) @@ -167,17 +168,16 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(8 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(7 rows) -- test cast pushdown :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = '1'::text::int ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -185,192 +185,213 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id = v0) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (device_id = v0) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v1) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test expressions :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = 1 + 4 / 2 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) (4 rows) -- test function calls -- not yet pushed down -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2392 - -> Sort (actual rows=6 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (device_id = length("substring"(version(), 1, 3))) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) -- test segment meta pushdown -- order by column and const -:PREFIX SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2985 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) - Rows Removed by Filter: 15 -(10 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk + Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(5 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=150 loops=1) - Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2840 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=155 loops=1) - Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2835 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17840 loops=1) - Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 150 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) --pushdowns between order by and segment by columns :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Vectorized Filter: (v0 < 1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Vectorized Filter: (v0 < 1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 < device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v0) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v0) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v1 = device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v1 = device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v1 = device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown between two order by column (not pushed down) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 = v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 = v1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 = v1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' AND device_id = 1 ORDER BY time, device_id LIMIT 10; @@ -382,63 +403,67 @@ QUERY PLAN Vectorized Filter: (_hyper_X_X_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 31 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) Filter: (compress_hyper_X_X_chunk._ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (11 rows) --pushdown of quals on order by and segment by cols or together (not pushed down) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17866 loops=1) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 124 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) --functions not yet optimized :PREFIX SELECT * FROM :TEST_TABLE WHERE time < now() ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Vectorized Filter: ("time" < now()) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test sort optimization interaction -:PREFIX SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Sort (actual rows=6 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Sort Sort Key: compress_hyper_X_X_chunk._ts_meta_max_1 DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + -> Seq Scan on compress_hyper_X_X_chunk +(5 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk +(7 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (3 rows) -- test aggregate @@ -452,29 +477,21 @@ QUERY PLAN -- test aggregate with GROUP BY :PREFIX SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(4 rows) -- test window functions with GROUP BY :PREFIX SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> WindowAgg (actual rows=5 loops=1) - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(9 rows) + WindowAgg (actual rows=5 loops=1) + -> GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(5 rows) -- test CTE :PREFIX WITH q AS ( @@ -505,11 +522,11 @@ QUERY PLAN Merge Join (actual rows=3598 loops=1) Merge Cond: (_hyper_X_X_chunk."time" = _hyper_X_X_chunk_1."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Materialize (actual rows=3598 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk _hyper_X_X_chunk_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) (9 rows) @@ -521,7 +538,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -532,7 +549,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -543,7 +560,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk test_table (actual rows=3598 loops=1) Output: test_table.*, test_table.device_id, test_table."time" Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -554,7 +571,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -565,7 +582,7 @@ QUERY PLAN Output: count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (7 rows) @@ -578,7 +595,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -599,7 +616,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=2) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (16 rows) @@ -610,7 +627,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -631,7 +648,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=2) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (16 rows) @@ -651,7 +668,7 @@ QUERY PLAN Output: "*VALUES*".column1 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk Output: _hyper_X_X_chunk.device_id - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (14 rows) @@ -663,13 +680,11 @@ CREATE OR REPLACE VIEW compressed_view AS SELECT time, device_id, v1, v2 FROM :T QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) DROP VIEW compressed_view; -SET parallel_leader_participation TO off; -SET min_parallel_table_scan_size TO '0'; -- test INNER JOIN :PREFIX_NO_VERBOSE SELECT * @@ -688,7 +703,7 @@ QUERY PLAN -> Seq Scan on compress_hyper_X_X_chunk -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 Filter: (m1."time" = "time") - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = m1.device_id) (10 rows) @@ -704,21 +719,23 @@ FROM :TEST_TABLE m1 LIMIT 10; QUERY PLAN Limit - -> Nested Loop + -> Merge Join + Merge Cond: (m1."time" = m3."time") -> Nested Loop - Join Filter: (m1."time" = m3."time") -> Sort Sort Key: m1."time", m1.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 -> Seq Scan on compress_hyper_X_X_chunk + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 + Filter: (m1."time" = "time") + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + Index Cond: (device_id = m1.device_id) + -> Sort + Sort Key: m3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m3 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 - Index Cond: (device_id = 3) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - Filter: (m1."time" = "time") - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 - Index Cond: (device_id = m1.device_id) -(15 rows) + -> Seq Scan on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 + Filter: (device_id = 3) +(17 rows) RESET min_parallel_table_scan_size; :PREFIX_NO_VERBOSE @@ -737,11 +754,11 @@ QUERY PLAN -> Merge Join Merge Cond: (m1."time" = m2."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk Index Cond: (device_id = 1) -> Materialize -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (10 rows) @@ -832,7 +849,7 @@ QUERY PLAN -> Sort Sort Key: m2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (16 rows) @@ -922,7 +939,7 @@ PREPARE prep AS SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -975,7 +992,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 @@ -989,7 +1006,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 diff --git a/tsl/test/shared/expected/transparent_decompress_chunk-14.out b/tsl/test/shared/expected/transparent_decompress_chunk-14.out index c6aeb796f75..e08e7de6a01 100644 --- a/tsl/test/shared/expected/transparent_decompress_chunk-14.out +++ b/tsl/test/shared/expected/transparent_decompress_chunk-14.out @@ -5,6 +5,8 @@ \set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)' \set PREFIX_NO_ANALYZE 'EXPLAIN (verbose, costs off)' \set PREFIX_NO_VERBOSE 'EXPLAIN (costs off)' +SET parallel_leader_participation TO off; +SET min_parallel_table_scan_size TO '0'; SELECT show_chunks('metrics_compressed') AS "TEST_TABLE" ORDER BY 1::text LIMIT 1 \gset -- this should use DecompressChunk node :PREFIX_VERBOSE @@ -15,7 +17,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=5 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (8 rows) @@ -51,10 +53,9 @@ QUERY PLAN Sort Key: t."time", t.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk t (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(7 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(6 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; @@ -67,10 +68,9 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < 0; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 20 -(4 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(3 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; @@ -86,7 +86,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -97,7 +97,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -105,7 +105,7 @@ QUERY PLAN :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (3 rows) @@ -132,21 +132,22 @@ QUERY PLAN QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) -- test IS NULL / IS NOT NULL -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (device_id IS NOT NULL) -(7 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (device_id IS NOT NULL) +(8 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN @@ -155,7 +156,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) Index Cond: (device_id IS NULL) (7 rows) @@ -167,17 +168,16 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(8 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(7 rows) -- test cast pushdown :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = '1'::text::int ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -185,192 +185,213 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id = v0) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (device_id = v0) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v1) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test expressions :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = 1 + 4 / 2 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) (4 rows) -- test function calls -- not yet pushed down -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2392 - -> Sort (actual rows=6 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (device_id = length("substring"(version(), 1, 3))) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) -- test segment meta pushdown -- order by column and const -:PREFIX SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2985 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) - Rows Removed by Filter: 15 -(10 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk + Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(5 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=150 loops=1) - Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2840 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=155 loops=1) - Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2835 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17840 loops=1) - Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 150 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) --pushdowns between order by and segment by columns :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Vectorized Filter: (v0 < 1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Vectorized Filter: (v0 < 1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 < device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v0) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v0) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v1 = device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v1 = device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v1 = device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown between two order by column (not pushed down) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 = v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 = v1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 = v1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' AND device_id = 1 ORDER BY time, device_id LIMIT 10; @@ -382,63 +403,67 @@ QUERY PLAN Vectorized Filter: (_hyper_X_X_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 31 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) Filter: (compress_hyper_X_X_chunk._ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (11 rows) --pushdown of quals on order by and segment by cols or together (not pushed down) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17866 loops=1) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 124 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) --functions not yet optimized :PREFIX SELECT * FROM :TEST_TABLE WHERE time < now() ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Vectorized Filter: ("time" < now()) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test sort optimization interaction -:PREFIX SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Sort (actual rows=6 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Sort Sort Key: compress_hyper_X_X_chunk._ts_meta_max_1 DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + -> Seq Scan on compress_hyper_X_X_chunk +(5 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk +(7 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (3 rows) -- test aggregate @@ -452,29 +477,21 @@ QUERY PLAN -- test aggregate with GROUP BY :PREFIX SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(4 rows) -- test window functions with GROUP BY :PREFIX SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> WindowAgg (actual rows=5 loops=1) - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(9 rows) + WindowAgg (actual rows=5 loops=1) + -> GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(5 rows) -- test CTE :PREFIX WITH q AS ( @@ -505,11 +522,11 @@ QUERY PLAN Merge Join (actual rows=3598 loops=1) Merge Cond: (_hyper_X_X_chunk."time" = _hyper_X_X_chunk_1."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Materialize (actual rows=3598 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk _hyper_X_X_chunk_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) (9 rows) @@ -521,7 +538,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -532,7 +549,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -543,7 +560,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk test_table (actual rows=3598 loops=1) Output: test_table.*, test_table.device_id, test_table."time" Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -554,7 +571,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -565,7 +582,7 @@ QUERY PLAN Output: count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (7 rows) @@ -578,7 +595,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -599,7 +616,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=2) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (16 rows) @@ -610,7 +627,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -631,7 +648,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=2) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (16 rows) @@ -651,7 +668,7 @@ QUERY PLAN Output: "*VALUES*".column1 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk Output: _hyper_X_X_chunk.device_id - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (14 rows) @@ -663,13 +680,11 @@ CREATE OR REPLACE VIEW compressed_view AS SELECT time, device_id, v1, v2 FROM :T QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) DROP VIEW compressed_view; -SET parallel_leader_participation TO off; -SET min_parallel_table_scan_size TO '0'; -- test INNER JOIN :PREFIX_NO_VERBOSE SELECT * @@ -688,7 +703,7 @@ QUERY PLAN -> Seq Scan on compress_hyper_X_X_chunk -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 Filter: (m1."time" = "time") - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = m1.device_id) (10 rows) @@ -704,21 +719,23 @@ FROM :TEST_TABLE m1 LIMIT 10; QUERY PLAN Limit - -> Nested Loop + -> Merge Join + Merge Cond: (m1."time" = m3."time") -> Nested Loop - Join Filter: (m1."time" = m3."time") -> Sort Sort Key: m1."time", m1.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 -> Seq Scan on compress_hyper_X_X_chunk + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 + Filter: (m1."time" = "time") + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + Index Cond: (device_id = m1.device_id) + -> Sort + Sort Key: m3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m3 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 - Index Cond: (device_id = 3) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - Filter: (m1."time" = "time") - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 - Index Cond: (device_id = m1.device_id) -(15 rows) + -> Seq Scan on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 + Filter: (device_id = 3) +(17 rows) RESET min_parallel_table_scan_size; :PREFIX_NO_VERBOSE @@ -737,11 +754,11 @@ QUERY PLAN -> Merge Join Merge Cond: (m1."time" = m2."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk Index Cond: (device_id = 1) -> Materialize -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (10 rows) @@ -832,7 +849,7 @@ QUERY PLAN -> Sort Sort Key: m2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (16 rows) @@ -922,7 +939,7 @@ PREPARE prep AS SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -975,7 +992,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 @@ -989,7 +1006,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 diff --git a/tsl/test/shared/expected/transparent_decompress_chunk-15.out b/tsl/test/shared/expected/transparent_decompress_chunk-15.out index 90e0a2e144e..6167c6c8ec7 100644 --- a/tsl/test/shared/expected/transparent_decompress_chunk-15.out +++ b/tsl/test/shared/expected/transparent_decompress_chunk-15.out @@ -5,6 +5,8 @@ \set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)' \set PREFIX_NO_ANALYZE 'EXPLAIN (verbose, costs off)' \set PREFIX_NO_VERBOSE 'EXPLAIN (costs off)' +SET parallel_leader_participation TO off; +SET min_parallel_table_scan_size TO '0'; SELECT show_chunks('metrics_compressed') AS "TEST_TABLE" ORDER BY 1::text LIMIT 1 \gset -- this should use DecompressChunk node :PREFIX_VERBOSE @@ -15,7 +17,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=5 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (8 rows) @@ -47,15 +49,14 @@ FROM :TEST_TABLE t WHERE device_id IN (1, 2) ORDER BY time, device_id; QUERY PLAN - Result (actual rows=7196 loops=1) - -> Sort (actual rows=7196 loops=1) - Sort Key: t."time", t.device_id - Sort Method: quicksort + Sort (actual rows=7196 loops=1) + Sort Key: t."time", t.device_id + Sort Method: quicksort + -> Result (actual rows=7196 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk t (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(8 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(7 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; @@ -68,10 +69,9 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < 0; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 20 -(4 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(3 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; @@ -88,7 +88,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -99,7 +99,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -107,7 +107,7 @@ QUERY PLAN :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (3 rows) @@ -134,21 +134,22 @@ QUERY PLAN QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) -- test IS NULL / IS NOT NULL -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (device_id IS NOT NULL) -(7 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (device_id IS NOT NULL) +(8 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN @@ -157,7 +158,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) Index Cond: (device_id IS NULL) (7 rows) @@ -169,17 +170,16 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(8 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(7 rows) -- test cast pushdown :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = '1'::text::int ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -187,192 +187,213 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id = v0) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (device_id = v0) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v1) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test expressions :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = 1 + 4 / 2 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) (4 rows) -- test function calls -- not yet pushed down -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2392 - -> Sort (actual rows=6 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (device_id = length("substring"(version(), 1, 3))) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) -- test segment meta pushdown -- order by column and const -:PREFIX SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2985 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) - Rows Removed by Filter: 15 -(10 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk + Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(5 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=150 loops=1) - Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2840 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=155 loops=1) - Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2835 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17840 loops=1) - Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 150 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) --pushdowns between order by and segment by columns :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Vectorized Filter: (v0 < 1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Vectorized Filter: (v0 < 1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 < device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v0) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v0) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v1 = device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v1 = device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v1 = device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown between two order by column (not pushed down) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 = v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 = v1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 = v1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' AND device_id = 1 ORDER BY time, device_id LIMIT 10; @@ -384,63 +405,67 @@ QUERY PLAN Vectorized Filter: (_hyper_X_X_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 31 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) Filter: (compress_hyper_X_X_chunk._ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (11 rows) --pushdown of quals on order by and segment by cols or together (not pushed down) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17866 loops=1) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 124 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) --functions not yet optimized :PREFIX SELECT * FROM :TEST_TABLE WHERE time < now() ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Vectorized Filter: ("time" < now()) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test sort optimization interaction -:PREFIX SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Sort (actual rows=6 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Sort Sort Key: compress_hyper_X_X_chunk._ts_meta_max_1 DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + -> Seq Scan on compress_hyper_X_X_chunk +(5 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk +(7 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (3 rows) -- test aggregate @@ -454,29 +479,21 @@ QUERY PLAN -- test aggregate with GROUP BY :PREFIX SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(4 rows) -- test window functions with GROUP BY :PREFIX SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> WindowAgg (actual rows=5 loops=1) - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(9 rows) + WindowAgg (actual rows=5 loops=1) + -> GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(5 rows) -- test CTE :PREFIX WITH q AS ( @@ -507,11 +524,11 @@ QUERY PLAN Merge Join (actual rows=3598 loops=1) Merge Cond: (_hyper_X_X_chunk."time" = _hyper_X_X_chunk_1."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Materialize (actual rows=3598 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk _hyper_X_X_chunk_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) (9 rows) @@ -523,7 +540,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -534,7 +551,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -545,7 +562,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk test_table (actual rows=3598 loops=1) Output: test_table.*, test_table.device_id, test_table."time" Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -556,7 +573,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -567,7 +584,7 @@ QUERY PLAN Output: count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (7 rows) @@ -580,7 +597,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -601,7 +618,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=2) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (16 rows) @@ -612,7 +629,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -633,7 +650,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=2) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=2) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (16 rows) @@ -653,7 +670,7 @@ QUERY PLAN Output: "*VALUES*".column1 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk Output: _hyper_X_X_chunk.device_id - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = "*VALUES*".column1) (14 rows) @@ -665,13 +682,11 @@ CREATE OR REPLACE VIEW compressed_view AS SELECT time, device_id, v1, v2 FROM :T QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) DROP VIEW compressed_view; -SET parallel_leader_participation TO off; -SET min_parallel_table_scan_size TO '0'; -- test INNER JOIN :PREFIX_NO_VERBOSE SELECT * @@ -690,7 +705,7 @@ QUERY PLAN -> Seq Scan on compress_hyper_X_X_chunk -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 Filter: (m1."time" = "time") - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = m1.device_id) (10 rows) @@ -706,21 +721,23 @@ FROM :TEST_TABLE m1 LIMIT 10; QUERY PLAN Limit - -> Nested Loop + -> Merge Join + Merge Cond: (m1."time" = m3."time") -> Nested Loop - Join Filter: (m1."time" = m3."time") -> Sort Sort Key: m1."time", m1.device_id -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 -> Seq Scan on compress_hyper_X_X_chunk + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 + Filter: (m1."time" = "time") + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + Index Cond: (device_id = m1.device_id) + -> Sort + Sort Key: m3."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m3 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 - Index Cond: (device_id = 3) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - Filter: (m1."time" = "time") - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 - Index Cond: (device_id = m1.device_id) -(15 rows) + -> Seq Scan on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_2 + Filter: (device_id = 3) +(17 rows) RESET min_parallel_table_scan_size; :PREFIX_NO_VERBOSE @@ -739,11 +756,11 @@ QUERY PLAN -> Merge Join Merge Cond: (m1."time" = m2."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk Index Cond: (device_id = 1) -> Materialize -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (10 rows) @@ -834,7 +851,7 @@ QUERY PLAN -> Sort Sort Key: m2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (16 rows) @@ -924,7 +941,7 @@ PREPARE prep AS SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -977,7 +994,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 @@ -991,7 +1008,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 diff --git a/tsl/test/shared/expected/transparent_decompress_chunk-16.out b/tsl/test/shared/expected/transparent_decompress_chunk-16.out index 41b92b1b445..b0e7ecafaec 100644 --- a/tsl/test/shared/expected/transparent_decompress_chunk-16.out +++ b/tsl/test/shared/expected/transparent_decompress_chunk-16.out @@ -5,6 +5,8 @@ \set PREFIX_VERBOSE 'EXPLAIN (analyze, costs off, timing off, summary off, verbose)' \set PREFIX_NO_ANALYZE 'EXPLAIN (verbose, costs off)' \set PREFIX_NO_VERBOSE 'EXPLAIN (costs off)' +SET parallel_leader_participation TO off; +SET min_parallel_table_scan_size TO '0'; SELECT show_chunks('metrics_compressed') AS "TEST_TABLE" ORDER BY 1::text LIMIT 1 \gset -- this should use DecompressChunk node :PREFIX_VERBOSE @@ -15,7 +17,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=5 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (8 rows) @@ -47,15 +49,14 @@ FROM :TEST_TABLE t WHERE device_id IN (1, 2) ORDER BY time, device_id; QUERY PLAN - Result (actual rows=7196 loops=1) - -> Sort (actual rows=7196 loops=1) - Sort Key: t."time", t.device_id - Sort Method: quicksort + Sort (actual rows=7196 loops=1) + Sort Key: t."time", t.device_id + Sort Method: quicksort + -> Result (actual rows=7196 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk t (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(8 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(7 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; @@ -68,10 +69,9 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < 0; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id < 0) - Rows Removed by Filter: 20 -(4 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) + Index Cond: (device_id < 0) +(3 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; @@ -88,7 +88,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -99,7 +99,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk.v1 Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (6 rows) @@ -107,7 +107,7 @@ QUERY PLAN :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (3 rows) @@ -134,21 +134,22 @@ QUERY PLAN QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) -- test IS NULL / IS NOT NULL -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (device_id IS NOT NULL) -(7 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (device_id IS NOT NULL) +(8 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; QUERY PLAN @@ -157,7 +158,7 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=1) Index Cond: (device_id IS NULL) (7 rows) @@ -169,17 +170,16 @@ QUERY PLAN Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=7196 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 12 -(8 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) +(7 rows) -- test cast pushdown :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = '1'::text::int ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -187,192 +187,213 @@ QUERY PLAN :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (device_id = v0) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (device_id = v0) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v1) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test expressions :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = 1 + 4 / 2 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 3) (4 rows) -- test function calls -- not yet pushed down -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2392 - -> Sort (actual rows=6 loops=1) - Sort Key: compress_hyper_X_X_chunk._ts_meta_min_1 - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (device_id = length("substring"(version(), 1, 3))) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) -- test segment meta pushdown -- order by column and const -:PREFIX SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=5 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2985 - -> Sort (actual rows=5 loops=1) - Sort Key: compress_hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) - Rows Removed by Filter: 15 -(10 rows) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk + Filter: ((_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone)) +(5 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=150 loops=1) - Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2840 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=155 loops=1) - Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2835 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=5 loops=1) - Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 -(10 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_min_1 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17840 loops=1) - Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 150 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) -:PREFIX SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17835 loops=1) - Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 155 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) - Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Parallel Seq Scan on compress_hyper_X_X_chunk + Filter: (_ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (9 rows) --pushdowns between order by and segment by columns :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Vectorized Filter: (v0 < 1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Vectorized Filter: (v0 < 1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 < device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id < v0 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Filter: (device_id < v0) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Filter: (device_id < v0) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) :PREFIX SELECT * FROM :TEST_TABLE WHERE v1 = device_id ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v1 = device_id) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v1 = device_id) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown between two order by column (not pushed down) :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 = v1 ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=0 loops=1) - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=1) - Filter: (v0 = v1) - Rows Removed by Filter: 17990 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + -> Gather Merge (actual rows=0 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=0 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: quicksort + Worker 1: Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=0 loops=2) + Filter: (v0 = v1) + Rows Removed by Filter: 8995 + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(12 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' AND device_id = 1 ORDER BY time, device_id LIMIT 10; @@ -384,63 +405,67 @@ QUERY PLAN Vectorized Filter: (_hyper_X_X_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 31 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=1 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) Filter: (compress_hyper_X_X_chunk._ts_meta_max_1 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (11 rows) --pushdown of quals on order by and segment by cols or together (not pushed down) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17866 loops=1) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 124 - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (8 rows) --functions not yet optimized :PREFIX SELECT * FROM :TEST_TABLE WHERE time < now() ORDER BY time, device_id LIMIT 10; QUERY PLAN Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(7 rows) + -> Gather Merge (actual rows=10 loops=1) + Workers Planned: 2 + Workers Launched: 2 + -> Sort (actual rows=10 loops=2) + Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id + Worker 0: Sort Method: top-N heapsort + Worker 1: Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2) + Vectorized Filter: ("time" < now()) + -> Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2) +(11 rows) -- test sort optimization interaction -:PREFIX SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Sort (actual rows=6 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Sort Sort Key: compress_hyper_X_X_chunk._ts_meta_max_1 DESC - Sort Method: quicksort - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + -> Seq Scan on compress_hyper_X_X_chunk +(5 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Sort (actual rows=10 loops=1) - Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(6 rows) + Limit + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: _hyper_X_X_chunk."time" DESC, _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Parallel Seq Scan on compress_hyper_X_X_chunk +(7 rows) -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; QUERY PLAN - Limit (actual rows=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + Limit + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (3 rows) -- test aggregate @@ -454,29 +479,21 @@ QUERY PLAN -- test aggregate with GROUP BY :PREFIX SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(8 rows) + GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(4 rows) -- test window functions with GROUP BY :PREFIX SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; QUERY PLAN - Sort (actual rows=5 loops=1) - Sort Key: _hyper_X_X_chunk.device_id - Sort Method: quicksort - -> WindowAgg (actual rows=5 loops=1) - -> HashAggregate (actual rows=5 loops=1) - Group Key: _hyper_X_X_chunk.device_id - Batches: 1 - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=20 loops=1) -(9 rows) + WindowAgg (actual rows=5 loops=1) + -> GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_X_X_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=17990 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=20 loops=1) +(5 rows) -- test CTE :PREFIX WITH q AS ( @@ -507,11 +524,11 @@ QUERY PLAN Merge Join (actual rows=3598 loops=1) Merge Cond: (_hyper_X_X_chunk."time" = _hyper_X_X_chunk_1."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) -> Materialize (actual rows=3598 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk _hyper_X_X_chunk_1 (actual rows=3598 loops=1) - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 (actual rows=4 loops=1) Index Cond: (device_id = 2) (9 rows) @@ -523,7 +540,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -534,7 +551,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id, _hyper_X_X_chunk.v0, _hyper_X_X_chunk.v1, _hyper_X_X_chunk.v2, _hyper_X_X_chunk.v3 Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -545,7 +562,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk test_table (actual rows=3598 loops=1) Output: test_table.*, test_table.device_id, test_table."time" Bulk Decompression: true - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -556,7 +573,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -567,7 +584,7 @@ QUERY PLAN Output: count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (7 rows) @@ -580,7 +597,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -613,7 +630,7 @@ QUERY PLAN Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk (actual rows=3598 loops=1) Output: _hyper_X_X_chunk.device_id Bulk Decompression: false - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk (actual rows=4 loops=1) Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 Index Cond: (compress_hyper_X_X_chunk.device_id = 1) (6 rows) @@ -645,7 +662,7 @@ QUERY PLAN Hash Cond: (_hyper_X_X_chunk.device_id = "*VALUES*".column1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_X_X_chunk Output: _hyper_X_X_chunk.device_id - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on _timescaledb_internal.compress_hyper_X_X_chunk + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on _timescaledb_internal.compress_hyper_X_X_chunk Output: compress_hyper_X_X_chunk."time", compress_hyper_X_X_chunk.device_id, compress_hyper_X_X_chunk.v0, compress_hyper_X_X_chunk.v1, compress_hyper_X_X_chunk.v2, compress_hyper_X_X_chunk.v3, compress_hyper_X_X_chunk._ts_meta_count, compress_hyper_X_X_chunk._ts_meta_sequence_num, compress_hyper_X_X_chunk._ts_meta_min_1, compress_hyper_X_X_chunk._ts_meta_max_1 -> Hash Output: "*VALUES*".column1 @@ -660,13 +677,11 @@ CREATE OR REPLACE VIEW compressed_view AS SELECT time, device_id, v1, v2 FROM :T QUERY PLAN Limit (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=1 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=1 loops=1) Index Cond: (device_id = 1) (4 rows) DROP VIEW compressed_view; -SET parallel_leader_participation TO off; -SET min_parallel_table_scan_size TO '0'; -- test INNER JOIN :PREFIX_NO_VERBOSE SELECT * @@ -736,11 +751,11 @@ QUERY PLAN -> Merge Join Merge Cond: (m1."time" = m2."time") -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk Index Cond: (device_id = 1) -> Materialize -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan Backward using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan Backward using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (10 rows) @@ -831,7 +846,7 @@ QUERY PLAN -> Sort Sort Key: m2."time" -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m2 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk compress_hyper_X_X_chunk_1 Index Cond: (device_id = 2) (16 rows) @@ -921,7 +936,7 @@ PREPARE prep AS SELECT count(time) FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=4 loops=1) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) Index Cond: (device_id = 1) (4 rows) @@ -974,7 +989,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 @@ -988,7 +1003,7 @@ QUERY PLAN -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk m1 (actual rows=0 loops=32) Filter: ("time" = g."time") Rows Removed by Filter: 81 - -> Index Scan using compress_hyper_X_X_chunk__compressed_hypertable_4_device_id__t on compress_hyper_X_X_chunk (actual rows=0 loops=32) + -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_sequence_num_idx on compress_hyper_X_X_chunk (actual rows=0 loops=32) Index Cond: (device_id = $1) Filter: ((_ts_meta_min_1 <= g."time") AND (_ts_meta_max_1 >= g."time")) Rows Removed by Filter: 4 diff --git a/tsl/test/shared/sql/compat.sql b/tsl/test/shared/sql/compat.sql index a10920272c6..e785bdca7d0 100644 --- a/tsl/test/shared/sql/compat.sql +++ b/tsl/test/shared/sql/compat.sql @@ -34,7 +34,6 @@ SELECT pg_typeof(_timescaledb_internal.get_git_commit()); SELECT pg_typeof(_timescaledb_internal.get_os_info()); SELECT _timescaledb_internal.get_partition_for_key(NULL::text); SELECT _timescaledb_internal.get_partition_hash(NULL::text); -SELECT _timescaledb_internal.hypertable_constraint_add_table_fk_constraint(NULL,NULL,NULL,0); SELECT _timescaledb_internal.hypertable_invalidation_log_delete(0); SELECT _timescaledb_internal.hypertable_local_size(NULL,NULL); SELECT _timescaledb_internal.indexes_local_size(NULL,NULL); diff --git a/tsl/test/shared/sql/transparent_decompress_chunk.sql.in b/tsl/test/shared/sql/transparent_decompress_chunk.sql.in index 10e375cbed6..5197bf58d24 100644 --- a/tsl/test/shared/sql/transparent_decompress_chunk.sql.in +++ b/tsl/test/shared/sql/transparent_decompress_chunk.sql.in @@ -7,6 +7,9 @@ \set PREFIX_NO_ANALYZE 'EXPLAIN (verbose, costs off)' \set PREFIX_NO_VERBOSE 'EXPLAIN (costs off)' +SET parallel_leader_participation TO off; +SET min_parallel_table_scan_size TO '0'; + SELECT show_chunks('metrics_compressed') AS "TEST_TABLE" ORDER BY 1::text LIMIT 1 \gset -- this should use DecompressChunk node @@ -57,7 +60,7 @@ ORDER BY time, device_id; :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time, device_id LIMIT 10; -- test IS NULL / IS NOT NULL -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; :PREFIX SELECT * FROM :TEST_TABLE WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; @@ -76,18 +79,18 @@ ORDER BY time, device_id; -- test function calls -- not yet pushed down -:PREFIX SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; -- -- test segment meta pushdown -- -- order by column and const -:PREFIX SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; -:PREFIX SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; -:PREFIX SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; -:PREFIX SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; -:PREFIX SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time = '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time < '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time <= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time >= '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE '2000-01-01 1:00:00+0' < time ORDER BY time, device_id LIMIT 10; --pushdowns between order by and segment by columns :PREFIX SELECT * FROM :TEST_TABLE WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; @@ -102,17 +105,17 @@ ORDER BY time, device_id; :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' AND device_id = 1 ORDER BY time, device_id LIMIT 10; --pushdown of quals on order by and segment by cols or together (not pushed down) -:PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-01 1:00:00+0' OR device_id = 1 ORDER BY time, device_id LIMIT 10; --functions not yet optimized :PREFIX SELECT * FROM :TEST_TABLE WHERE time < now() ORDER BY time, device_id LIMIT 10; -- test sort optimization interaction -:PREFIX SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time FROM :TEST_TABLE ORDER BY time DESC LIMIT 10; -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; -:PREFIX SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; +:PREFIX_NO_VERBOSE SELECT time, device_id FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; -- test aggregate :PREFIX SELECT count(*) FROM :TEST_TABLE; @@ -187,8 +190,6 @@ CREATE OR REPLACE VIEW compressed_view AS SELECT time, device_id, v1, v2 FROM :T DROP VIEW compressed_view; -SET parallel_leader_participation TO off; -SET min_parallel_table_scan_size TO '0'; -- test INNER JOIN :PREFIX_NO_VERBOSE SELECT * diff --git a/tsl/test/sql/compression_create_compressed_table.sql b/tsl/test/sql/compression_create_compressed_table.sql index 969c2264e54..c0ffad507ab 100644 --- a/tsl/test/sql/compression_create_compressed_table.sql +++ b/tsl/test/sql/compression_create_compressed_table.sql @@ -23,7 +23,7 @@ SELECT count(*) FROM _timescaledb_internal._hyper_1_1_chunk; SELECT compress_chunk('_timescaledb_internal._hyper_1_1_chunk'); -- create custom compressed chunk table -CREATE TABLE "_timescaledb_internal"."custom_compressed_chunk"() INHERITS ("_timescaledb_internal"."_compressed_hypertable_2"); +CREATE TABLE _timescaledb_internal.custom_compressed_chunk( LIKE _timescaledb_internal.compress_hyper_2_2_chunk); -- copy compressed row from compressed table into custom compressed chunk table INSERT INTO "_timescaledb_internal"."custom_compressed_chunk" SELECT * FROM "_timescaledb_internal"."compress_hyper_2_2_chunk"; diff --git a/tsl/test/sql/compression_ddl.sql b/tsl/test/sql/compression_ddl.sql index 8a599f27b82..06b0a102035 100644 --- a/tsl/test/sql/compression_ddl.sql +++ b/tsl/test/sql/compression_ddl.sql @@ -116,7 +116,7 @@ SELECT tablename FROM pg_tables WHERE tablespace = 'tablespace1'; \set ON_ERROR_STOP 0 -SELECT move_chunk(chunk=>:'COMPRESSED_CHUNK_NAME', destination_tablespace=>'tablespace1', index_destination_tablespace=>'tablespace1', reorder_index=>'_timescaledb_internal."compress_hyper_2_28_chunk__compressed_hypertable_2_b__ts_meta_s"'); +SELECT move_chunk(chunk=>:'COMPRESSED_CHUNK_NAME', destination_tablespace=>'tablespace1', index_destination_tablespace=>'tablespace1', reorder_index=>'_timescaledb_internal."compress_hyper_2_28_chunk_b__ts_meta_sequence_num_idx"'); \set ON_ERROR_STOP 1 -- ensure that both compressed and uncompressed chunks moved diff --git a/tsl/test/sql/compression_hypertable.sql b/tsl/test/sql/compression_hypertable.sql index 8b9d2f11a7f..af335e8c9ef 100644 --- a/tsl/test/sql/compression_hypertable.sql +++ b/tsl/test/sql/compression_hypertable.sql @@ -70,7 +70,7 @@ SELECT DISTINCT attname, attstattarget SELECT DISTINCT attname, attstattarget FROM pg_attribute - WHERE attrelid in (SELECT "Child" FROM test.show_subtables('_timescaledb_internal._compressed_hypertable_2')) + WHERE attrelid in (SELECT format('%I.%I', schema_name, table_name)::regclass FROM _timescaledb_catalog.chunk ch WHERE ch.hypertable_id = 2) AND attnum > 0 ORDER BY attname; @@ -92,8 +92,8 @@ TRUNCATE test1; SELECT * FROM test1; /* nor compressed table */ SELECT * FROM _timescaledb_internal._compressed_hypertable_2; -/* the compressed table should have not chunks */ -EXPLAIN (costs off) SELECT * FROM _timescaledb_internal._compressed_hypertable_2; +/* the compressed table should not have chunks */ +SELECT count(*) FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2; --add test for altered hypertable CREATE TABLE test2 ("Time" timestamptz, i integer, b bigint, t text); @@ -174,7 +174,7 @@ SELECT DISTINCT attname, attstattarget SELECT DISTINCT attname, attstattarget FROM pg_attribute - WHERE attrelid in (SELECT "Child" FROM test.show_subtables('_timescaledb_internal._compressed_hypertable_6')) + WHERE attrelid in (SELECT format('%I.%I', schema_name, table_name)::regclass FROM _timescaledb_catalog.chunk ch WHERE ch.hypertable_id = 6) AND attnum > 0 ORDER BY attname; @@ -296,4 +296,4 @@ select distinct on (id) * from test8 order by id, ts desc, value ; -drop table test8; \ No newline at end of file +drop table test8; diff --git a/tsl/test/sql/compression_update_delete.sql b/tsl/test/sql/compression_update_delete.sql index 588d7f089b7..5316e76b523 100644 --- a/tsl/test/sql/compression_update_delete.sql +++ b/tsl/test/sql/compression_update_delete.sql @@ -1266,20 +1266,24 @@ CREATE TABLE tab1(filler_1 int, filler_2 int, filler_3 int, time timestamptz NOT SELECT create_hypertable('tab1','time',create_default_indexes:=false); INSERT INTO tab1(filler_1, filler_2, filler_3,time,device_id,v0,v1,v2,v3) SELECT device_id, device_id+1, device_id + 2, time, device_id, device_id+1, device_id + 2, device_id + 0.5, NULL FROM generate_series('2000-01-01 0:00:00+0'::timestamptz,'2000-01-05 23:55:00+0','2m') gtime(time), generate_series(1,5,1) gdevice(device_id); ALTER TABLE tab1 SET (timescaledb.compress, timescaledb.compress_orderby='time DESC', timescaledb.compress_segmentby='device_id, filler_1, filler_2, filler_3'); + +SELECT compress_chunk(show_chunks('tab1')); + +SELECT format('%I.%I', schema_name, table_name) AS "CHUNK" FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2 \gset + -- create multiple indexes on compressed hypertable -DROP INDEX _timescaledb_internal._compressed_hypertable_2_device_id_filler_1_filler_2_filler_idx; -CREATE INDEX ON _timescaledb_internal._compressed_hypertable_2 (_ts_meta_min_1); -CREATE INDEX ON _timescaledb_internal._compressed_hypertable_2 (_ts_meta_min_1, _ts_meta_sequence_num); -CREATE INDEX ON _timescaledb_internal._compressed_hypertable_2 (_ts_meta_min_1, _ts_meta_max_1, filler_1); - -CREATE INDEX filler_1 ON _timescaledb_internal._compressed_hypertable_2 (filler_1); -CREATE INDEX filler_2 ON _timescaledb_internal._compressed_hypertable_2 (filler_2); -CREATE INDEX filler_3 ON _timescaledb_internal._compressed_hypertable_2 (filler_3); +DROP INDEX _timescaledb_internal.compress_hyper_2_2_chunk_device_id_filler_1_filler_2_filler_idx; +CREATE INDEX ON :CHUNK (_ts_meta_min_1); +CREATE INDEX ON :CHUNK (_ts_meta_min_1, _ts_meta_sequence_num); +CREATE INDEX ON :CHUNK (_ts_meta_min_1, _ts_meta_max_1, filler_1); + +CREATE INDEX filler_1 ON :CHUNK (filler_1); +CREATE INDEX filler_2 ON :CHUNK (filler_2); +CREATE INDEX filler_3 ON :CHUNK (filler_3); -- below indexes should be selected -CREATE INDEX filler_1_filler_2 ON _timescaledb_internal._compressed_hypertable_2 (filler_1, filler_2); -CREATE INDEX filler_2_filler_3 ON _timescaledb_internal._compressed_hypertable_2 (filler_2, filler_3); +CREATE INDEX filler_1_filler_2 ON :CHUNK (filler_1, filler_2); +CREATE INDEX filler_2_filler_3 ON :CHUNK (filler_2, filler_3); -SELECT compress_chunk(show_chunks('tab1')); set timescaledb.debug_compression_path_info to on; BEGIN; SELECT COUNT(*) FROM tab1 WHERE filler_3 = 5 AND filler_2 = 4; @@ -1340,7 +1344,12 @@ generate_series(1, 3, 1 ) AS g2(source_id), generate_series(1, 3, 1 ) AS g3(label); SELECT compress_chunk(c) FROM show_chunks('t6367') c; -DROP INDEX _timescaledb_internal._compressed_hypertable_2_source_id_label__ts_meta_sequence__idx; + +SELECT format('%I.%I', schema_name, table_name) AS "CHUNK1" FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2 ORDER BY id LIMIT 1 \gset +SELECT format('%I.%I', schema_name, table_name) AS "CHUNK2" FROM _timescaledb_catalog.chunk WHERE hypertable_id = 2 ORDER BY id LIMIT 1 OFFSET 1 \gset + +DROP INDEX _timescaledb_internal.compress_hyper_2_3_chunk_source_id_label__ts_meta_sequence__idx; +DROP INDEX _timescaledb_internal.compress_hyper_2_4_chunk_source_id_label__ts_meta_sequence__idx; -- testcase with no index, should use seq scan set timescaledb.debug_compression_path_info to on; BEGIN; @@ -1350,7 +1359,8 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; ROLLBACK; -- test case with an index which has only one -- of the segmentby filters -CREATE INDEX source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (source_id); +CREATE INDEX source_id_idx1 ON :CHUNK1 (source_id); +CREATE INDEX source_id_idx2 ON :CHUNK2 (source_id); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label = '1'; @@ -1367,9 +1377,10 @@ SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NOT NULL; UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label IS NOT NULL; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label IS NOT NULL; ROLLBACK; -DROP INDEX _timescaledb_internal.source_id_idx; +DROP INDEX _timescaledb_internal.source_id_idx1; +DROP INDEX _timescaledb_internal.source_id_idx2; -- test case with an index which has multiple same column -CREATE INDEX source_id_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (source_id, source_id); +CREATE INDEX source_id_source_id_idx ON :CHUNK1 (source_id, source_id); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label = '1'; @@ -1378,7 +1389,7 @@ ROLLBACK; DROP INDEX _timescaledb_internal.source_id_source_id_idx; -- test using a non-btree index -- fallback to heap scan -CREATE INDEX brin_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 USING brin (source_id); +CREATE INDEX brin_source_id_idx ON :CHUNK1 USING brin (source_id); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label = '1'; @@ -1387,7 +1398,7 @@ ROLLBACK; DROP INDEX _timescaledb_internal.brin_source_id_idx; -- test using an expression index -- should fallback to heap scans -CREATE INDEX expr_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (upper(source_id)); +CREATE INDEX expr_source_id_idx ON :CHUNK1 (upper(source_id)); BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; UPDATE t6367 SET source_id = '0' WHERE source_id = '2' AND label = '1'; @@ -1396,7 +1407,7 @@ ROLLBACK; DROP INDEX _timescaledb_internal.expr_source_id_idx; -- test using a partial index -- should fallback to heap scans -CREATE INDEX partial_source_id_idx ON _timescaledb_internal._compressed_hypertable_2 (source_id) +CREATE INDEX partial_source_id_idx ON :CHUNK1 (source_id) WHERE _ts_meta_min_1 > '1990-01-01'::timestamptz; BEGIN; SELECT count(*) FROM t6367 WHERE source_id = '2' AND label = '1'; diff --git a/tsl/test/sql/include/compression_alter.sql b/tsl/test/sql/include/compression_alter.sql index 5d49bd0f531..a2d40eae136 100644 --- a/tsl/test/sql/include/compression_alter.sql +++ b/tsl/test/sql/include/compression_alter.sql @@ -73,11 +73,11 @@ SELECT count(*) FROM _timescaledb_catalog.chunk WHERE hypertable_id = ( SELECT id FROM _timescaledb_catalog.hypertable WHERE table_name = 'test1' ); -SELECT count(*) -FROM ( SELECT attrelid::regclass, attname FROM pg_attribute - WHERE attrelid in (SELECT inhrelid::regclass from pg_inherits - where inhparent = 'test1'::regclass) - and attname = 'bigintcol' ) q; +SELECT count(*) FROM pg_attribute att +INNER JOIN _timescaledb_catalog.chunk ch ON att.attrelid = format('%I.%I', ch.schema_name, ch.table_name)::regclass +INNER JOIN _timescaledb_catalog.hypertable ht ON ht.id = ch.hypertable_id AND ht.table_name = 'test1' +WHERE + attname = 'bigintcol'; --check count on internal compression table too i.e. all the chunks have --the correct column name @@ -85,11 +85,11 @@ SELECT format('%I.%I', cht.schema_name, cht.table_name) AS "COMPRESSION_TBLNM" FROM _timescaledb_catalog.hypertable ht, _timescaledb_catalog.hypertable cht WHERE ht.table_name = 'test1' and cht.id = ht.compressed_hypertable_id \gset -SELECT count(*) -FROM ( SELECT attrelid::regclass, attname FROM pg_attribute - WHERE attrelid in (SELECT inhrelid::regclass from pg_inherits - where inhparent = :'COMPRESSION_TBLNM'::regclass ) - and attname = 'bigintcol' ) q; +SELECT count(*) FROM pg_attribute att +INNER JOIN _timescaledb_catalog.chunk ch ON att.attrelid = format('%I.%I', ch.schema_name, ch.table_name)::regclass +INNER JOIN _timescaledb_catalog.hypertable ht ON ht.compressed_hypertable_id = ch.hypertable_id AND ht.table_name = 'test1' +WHERE + attname = 'bigintcol'; -- check column name truncation with renames -- check if the name change is reflected for settings @@ -100,11 +100,11 @@ SELECT * from _timescaledb_catalog.compression_settings WHERE relid = 'test1'::r SELECT * from timescaledb_information.compression_settings WHERE hypertable_name = 'test1' and attname like 'ccc%'; -SELECT count(*) -FROM ( SELECT attrelid::regclass, attname FROM pg_attribute - WHERE attrelid in (SELECT inhrelid::regclass from pg_inherits - where inhparent = :'COMPRESSION_TBLNM'::regclass ) - and attname like 'ccc%a' ) q; +SELECT count(*) FROM pg_attribute att +INNER JOIN _timescaledb_catalog.chunk ch ON att.attrelid = format('%I.%I', ch.schema_name, ch.table_name)::regclass +INNER JOIN _timescaledb_catalog.hypertable ht ON ht.compressed_hypertable_id = ch.hypertable_id AND ht.table_name = 'test1' +WHERE + attname like 'ccc%a'; ALTER TABLE test1 RENAME ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccabdeeeeeeccccccccccccc diff --git a/tsl/test/sql/include/compression_test_hypertable_segment_meta.sql b/tsl/test/sql/include/compression_test_hypertable_segment_meta.sql index 46b718b80b7..a542b94e216 100644 --- a/tsl/test/sql/include/compression_test_hypertable_segment_meta.sql +++ b/tsl/test/sql/include/compression_test_hypertable_segment_meta.sql @@ -10,11 +10,11 @@ SELECT 'NULL::'||:'TYPE' as "NULLTYPE" \gset SELECT count(compress_chunk(ch, true)) FROM show_chunks(:'HYPERTABLE_NAME') ch; SELECT - comp_hypertable.schema_name AS "COMP_SCHEMA_NAME", - comp_hypertable.table_name AS "COMP_TABLE_NAME" -FROM _timescaledb_catalog.hypertable uc_hypertable -INNER JOIN _timescaledb_catalog.hypertable comp_hypertable ON (comp_hypertable.id = uc_hypertable.compressed_hypertable_id) -WHERE uc_hypertable.table_name like :'HYPERTABLE_NAME' \gset + ch.schema_name AS "COMP_SCHEMA_NAME", + ch.table_name AS "COMP_TABLE_NAME" +FROM _timescaledb_catalog.hypertable ht +INNER JOIN _timescaledb_catalog.chunk ch ON (ch.hypertable_id = ht.compressed_hypertable_id) +WHERE ht.table_name like :'HYPERTABLE_NAME' ORDER BY ch.id LIMIT 1\gset SELECT bool_and(:SEGMENT_META_COL_MIN = true_min) as min_correct, diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 2121cc643f0..5103fb55e3e 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -187,18 +187,6 @@ FROM _timescaledb_catalog.hypertable ht -- no standard way to create an index on a compressed table. -- Once a standard way exists, modify this test to use that method. -CREATE INDEX c_index ON :METRICS_COMPRESSED (device_id); - -CREATE INDEX c_space_index ON :METRICS_SPACE_COMPRESSED (device_id); - -CREATE INDEX c_index_2 ON :METRICS_COMPRESSED (device_id, _ts_meta_count); - -CREATE INDEX c_space_index_2 ON :METRICS_SPACE_COMPRESSED (device_id, _ts_meta_count); - -CREATE INDEX ON :METRICS_COMPRESSED (device_id_peer); - -CREATE INDEX ON :METRICS_SPACE_COMPRESSED (device_id_peer); - \c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER CREATE INDEX ON metrics_space (device_id, device_id_peer, v0, v1 DESC, time);