From 76c1f973971334d1bd144c212a7d203bf652c023 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 3 May 2024 17:03:05 +0200 Subject: [PATCH 001/157] Add unsorted decompressed chunk path even if we have sorted ones The unsorted paths are better for hash aggregation, but currently in this case we are only going to add sorted paths. --- src/planner/planner.c | 3 - src/planner/planner.h | 3 + .../nodes/decompress_chunk/decompress_chunk.c | 178 +++++++++++------- 3 files changed, 112 insertions(+), 72 deletions(-) diff --git a/src/planner/planner.c b/src/planner/planner.c index 083b50d4554..cd5241e7153 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -270,9 +270,6 @@ ts_rte_is_hypertable(const RangeTblEntry *rte) return ht != NULL; } -#define IS_UPDL_CMD(parse) \ - ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) - typedef struct { Query *rootquery; diff --git a/src/planner/planner.h b/src/planner/planner.h index 6686aa75caa..8ee229df156 100644 --- a/src/planner/planner.h +++ b/src/planner/planner.h @@ -22,6 +22,9 @@ */ #define PLANNER_LOCATION_MAGIC -29811 +#define IS_UPDL_CMD(parse) \ + ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) + typedef struct Chunk Chunk; typedef struct Hypertable Hypertable; typedef struct TimescaleDBPrivate diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 25d8188c64f..a6215243af0 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -692,27 +692,20 @@ add_chunk_sorted_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hypertable *ht, } } -#define IS_UPDL_CMD(parse) \ - ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) void ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hypertable *ht, Chunk *chunk) { - RelOptInfo *compressed_rel; - ListCell *lc; - Index ht_relid = 0; - PlannerInfo *proot; - bool consider_partial = ts_chunk_is_partial(chunk); - /* * For UPDATE/DELETE commands, the executor decompresses and brings the rows into * the uncompressed chunk. Therefore, it's necessary to add the scan on the * uncompressed portion. */ + bool add_uncompressed_part = ts_chunk_is_partial(chunk); if (ts_chunk_is_compressed(chunk) && ts_cm_functions->decompress_target_segments && - !consider_partial) + !add_uncompressed_part) { - for (proot = root->parent_root; proot != NULL && !consider_partial; + for (PlannerInfo *proot = root->parent_root; proot != NULL && !add_uncompressed_part; proot = proot->parent_root) { /* @@ -722,7 +715,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp */ if (IS_UPDL_CMD(proot->parse)) { - consider_partial = true; + add_uncompressed_part = true; } } } @@ -749,14 +742,19 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp chunk, chunk_rel, sort_info.needs_sequence_num); - compressed_rel = compression_info->compressed_rel; + RelOptInfo *compressed_rel = compression_info->compressed_rel; compressed_rel->consider_parallel = chunk_rel->consider_parallel; /* translate chunk_rel->baserestrictinfo */ - pushdown_quals(root, compression_info->settings, chunk_rel, compressed_rel, consider_partial); + pushdown_quals(root, + compression_info->settings, + chunk_rel, + compressed_rel, + add_uncompressed_part); set_baserel_size_estimates(root, compressed_rel); double new_row_estimate = compressed_rel->rows * TARGET_COMPRESSED_BATCH_SIZE; + Index ht_relid = 0; if (!compression_info->single_chunk) { /* adjust the parent's estimate by the diff of new and old estimate */ @@ -777,6 +775,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp parent_relids = find_childrel_parents(root, chunk_rel); /* create non-parallel paths */ + ListCell *lc; foreach (lc, compressed_rel->pathlist) { Path *compressed_path = lfirst(lc); @@ -859,43 +858,12 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp continue; } - Path *chunk_path = + Path *unsorted_chunk_path = (Path *) decompress_chunk_path_create(root, compression_info, 0, compressed_path); - /* - * Create a path for the batch sorted merge optimization. This optimization performs a - * merge append of the involved batches by using a binary heap and preserving the - * compression order. This optimization is only taken into consideration if we can't push - * down the sort to the compressed chunk. If we can push down the sort, the batches can be - * directly consumed in this order and we don't need to use this optimization. - */ - DecompressChunkPath *batch_merge_path = NULL; - - if (ts_guc_enable_decompression_sorted_merge && !sort_info.can_pushdown_sort) - { - MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); - if (merge_result != MERGE_NOT_POSSIBLE) - { - batch_merge_path = copy_decompress_chunk_path((DecompressChunkPath *) chunk_path); - - batch_merge_path->reverse = (merge_result != SCAN_FORWARD); - batch_merge_path->batch_sorted_merge = true; - - /* The segment by optimization is only enabled if it can deliver the tuples in the - * same order as the query requested it. So, we can just copy the pathkeys of the - * query here. - */ - batch_merge_path->custom_path.path.pathkeys = root->query_pathkeys; - cost_batch_sorted_merge(root, compression_info, batch_merge_path, compressed_path); + Path *batch_merge_path = NULL; - /* If the chunk is partially compressed, prepare the path only and add it later - * to a merge append path when we are able to generate the ordered result for the - * compressed and uncompressed part of the chunk. - */ - if (!consider_partial) - add_path(chunk_rel, &batch_merge_path->custom_path.path); - } - } + Path *chunk_path_with_sort_pushdown = NULL; /* If we can push down the sort below the DecompressChunk node, we set the pathkeys of * the decompress node to the query pathkeys, while remembering the compressed_pathkeys @@ -904,7 +872,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp if (sort_info.can_pushdown_sort) { DecompressChunkPath *path_copy = - copy_decompress_chunk_path((DecompressChunkPath *) chunk_path); + copy_decompress_chunk_path((DecompressChunkPath *) unsorted_chunk_path); path_copy->reverse = sort_info.reverse; path_copy->needs_sequence_num = sort_info.needs_sequence_num; path_copy->required_compressed_pathkeys = sort_info.required_compressed_pathkeys; @@ -934,16 +902,46 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp cost_decompress_chunk(root, &path_copy->custom_path.path, &sort_path); } - chunk_path = &path_copy->custom_path.path; + chunk_path_with_sort_pushdown = (Path *) path_copy; + } + else if (ts_guc_enable_decompression_sorted_merge) + { + /* + * Create a path for the batch sorted merge optimization. This + * optimization performs a sorted merge of the involved batches by + * using a binary heap and preserving the compression order. This + * optimization is only taken into consideration if we can't push + * down the sort to the compressed chunk. If we can push down the + * sort, the batches can be directly consumed in this order and we + * don't need to use this optimization. + */ + MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); + if (merge_result != MERGE_NOT_POSSIBLE) + { + DecompressChunkPath *path_copy = + copy_decompress_chunk_path((DecompressChunkPath *) unsorted_chunk_path); + + path_copy->reverse = (merge_result != SCAN_FORWARD); + path_copy->batch_sorted_merge = true; + + /* The segment by optimization is only enabled if it can deliver the tuples in the + * same order as the query requested it. So, we can just copy the pathkeys of the + * query here. + */ + path_copy->custom_path.path.pathkeys = root->query_pathkeys; + cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); + + batch_merge_path = (Path *) path_copy; + } } /* * If this is a partially compressed chunk we have to combine data * from compressed and uncompressed chunk. */ - if (consider_partial) + if (add_uncompressed_part) { - Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path); + Bitmapset *req_outer = PATH_REQ_OUTER(unsorted_chunk_path); Path *uncompressed_path = get_cheapest_path_for_pathkeys(initial_pathlist, NIL, req_outer, TOTAL_COST, false); @@ -960,46 +958,88 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp continue; } - /* If we were able to generate a batch merge path, create a merge append path + /* + * If we were able to generate a batch merge path, create a merge append path * that combines the result of the compressed and uncompressed part of the chunk. The * uncompressed part will be sorted, the batch_merge_path is already properly sorted. */ if (batch_merge_path != NULL) { - chunk_path = (Path *) create_merge_append_path_compat(root, - chunk_rel, - list_make2(batch_merge_path, - uncompressed_path), - root->query_pathkeys, - req_outer, - NIL); + batch_merge_path = + (Path *) create_merge_append_path_compat(root, + chunk_rel, + list_make2(batch_merge_path, + uncompressed_path), + root->query_pathkeys, + req_outer, + NIL); } - else + + if (chunk_path_with_sort_pushdown != NULL) + { /* * Ideally, we would like for this to be a MergeAppend path. * However, accumulate_append_subpath will cut out MergeAppend * and directly add its children, so we have to combine the children * into a MergeAppend node later, at the chunk append level. */ - chunk_path = + chunk_path_with_sort_pushdown = (Path *) create_append_path_compat(root, chunk_rel, - list_make2(chunk_path, uncompressed_path), + list_make2(chunk_path_with_sort_pushdown, + uncompressed_path), NIL /* partial paths */, root->query_pathkeys /* pathkeys */, req_outer, 0, false, false, - chunk_path->rows + uncompressed_path->rows); + chunk_path_with_sort_pushdown->rows + + uncompressed_path->rows); + } + + unsorted_chunk_path = (Path *) + create_append_path_compat(root, + chunk_rel, + list_make2(unsorted_chunk_path, uncompressed_path), + NIL /* partial paths */, + NIL /* pathkeys */, + req_outer, + 0, + false, + false, + unsorted_chunk_path->rows + uncompressed_path->rows); } - /* Add useful sorted versions of the decompress path */ - add_chunk_sorted_paths(root, chunk_rel, ht, ht_relid, chunk_path, compressed_path); + if (batch_merge_path != NULL) + { + add_path(chunk_rel, (Path *) batch_merge_path); + } - /* this has to go after the path is copied for the ordered path since path can get freed in - * add_path */ - add_path(chunk_rel, chunk_path); + if (chunk_path_with_sort_pushdown != NULL) + { + add_path(chunk_rel, (Path *) chunk_path_with_sort_pushdown); + } + + if (chunk_path_with_sort_pushdown == NULL && batch_merge_path == NULL) + { + /* + * Add useful sorted versions of the decompress path, if we couldn't + * push down the sort. + */ + add_chunk_sorted_paths(root, + chunk_rel, + ht, + ht_relid, + unsorted_chunk_path, + compressed_path); + } + + /* + * This has to go after the path is copied for the ordered path since + * path can get freed in add_path(). + */ + add_path(chunk_rel, unsorted_chunk_path); } /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed @@ -1027,7 +1067,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp compressed_path->parallel_workers, compressed_path); - if (consider_partial) + if (add_uncompressed_part) { Bitmapset *req_outer = PATH_REQ_OUTER(path); Path *uncompressed_path = NULL; From 868d2532320edfe1329308806e60511c224ccab7 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 3 May 2024 17:27:27 +0200 Subject: [PATCH 002/157] label the path w/o sorting with the proper pathkeys --- .../nodes/decompress_chunk/decompress_chunk.c | 89 +++++++++++-------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index a6215243af0..f8bec41718e 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -858,35 +858,48 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp continue; } - Path *unsorted_chunk_path = + Path *chunk_path_no_sort = (Path *) decompress_chunk_path_create(root, compression_info, 0, compressed_path); Path *batch_merge_path = NULL; - Path *chunk_path_with_sort_pushdown = NULL; + Path *chunk_path_with_compressed_sort = NULL; - /* If we can push down the sort below the DecompressChunk node, we set the pathkeys of + /* + * If we can push down the sort below the DecompressChunk node, we set the pathkeys of * the decompress node to the query pathkeys, while remembering the compressed_pathkeys * corresponding to those query_pathkeys. We will determine whether to put a sort - * between the decompression node and the scan during plan creation */ + * between the decompression node and the scan during plan creation. + */ if (sort_info.can_pushdown_sort) { - DecompressChunkPath *path_copy = - copy_decompress_chunk_path((DecompressChunkPath *) unsorted_chunk_path); - path_copy->reverse = sort_info.reverse; - path_copy->needs_sequence_num = sort_info.needs_sequence_num; - path_copy->required_compressed_pathkeys = sort_info.required_compressed_pathkeys; - path_copy->custom_path.path.pathkeys = root->query_pathkeys; - - /* - * Add costing for a sort. The standard Postgres pattern is to add the cost during - * path creation, but not add the sort path itself, that's done during plan - * creation. Examples of this in: create_merge_append_path & - * create_merge_append_plan - */ - if (!pathkeys_contained_in(sort_info.required_compressed_pathkeys, - compressed_path->pathkeys)) + if (pathkeys_contained_in(sort_info.required_compressed_pathkeys, + compressed_path->pathkeys)) + { + /* + * The decompressed path already has the required ordering. + */ + chunk_path_no_sort->pathkeys = root->query_pathkeys; + } + else { + /* + * We must sort the underlying compressed path to get the + * required ordering. + */ + DecompressChunkPath *path_copy = + copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); + path_copy->reverse = sort_info.reverse; + path_copy->needs_sequence_num = sort_info.needs_sequence_num; + path_copy->required_compressed_pathkeys = sort_info.required_compressed_pathkeys; + path_copy->custom_path.path.pathkeys = root->query_pathkeys; + + /* + * Add costing for a sort. The standard Postgres pattern is to add the cost during + * path creation, but not add the sort path itself, that's done during plan + * creation. Examples of this in: create_merge_append_path & + * create_merge_append_plan + */ Path sort_path; /* dummy for result of cost_sort */ cost_sort(&sort_path, @@ -900,9 +913,9 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp -1); cost_decompress_chunk(root, &path_copy->custom_path.path, &sort_path); - } - chunk_path_with_sort_pushdown = (Path *) path_copy; + chunk_path_with_compressed_sort = (Path *) path_copy; + } } else if (ts_guc_enable_decompression_sorted_merge) { @@ -919,7 +932,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp if (merge_result != MERGE_NOT_POSSIBLE) { DecompressChunkPath *path_copy = - copy_decompress_chunk_path((DecompressChunkPath *) unsorted_chunk_path); + copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); path_copy->reverse = (merge_result != SCAN_FORWARD); path_copy->batch_sorted_merge = true; @@ -941,7 +954,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp */ if (add_uncompressed_part) { - Bitmapset *req_outer = PATH_REQ_OUTER(unsorted_chunk_path); + Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); Path *uncompressed_path = get_cheapest_path_for_pathkeys(initial_pathlist, NIL, req_outer, TOTAL_COST, false); @@ -970,12 +983,12 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp chunk_rel, list_make2(batch_merge_path, uncompressed_path), - root->query_pathkeys, + batch_merge_path->pathkeys, req_outer, NIL); } - if (chunk_path_with_sort_pushdown != NULL) + if (chunk_path_with_compressed_sort != NULL) { /* * Ideally, we would like for this to be a MergeAppend path. @@ -983,32 +996,32 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp * and directly add its children, so we have to combine the children * into a MergeAppend node later, at the chunk append level. */ - chunk_path_with_sort_pushdown = + chunk_path_with_compressed_sort = (Path *) create_append_path_compat(root, chunk_rel, - list_make2(chunk_path_with_sort_pushdown, + list_make2(chunk_path_with_compressed_sort, uncompressed_path), NIL /* partial paths */, - root->query_pathkeys /* pathkeys */, + chunk_path_with_compressed_sort->pathkeys, req_outer, 0, false, false, - chunk_path_with_sort_pushdown->rows + + chunk_path_with_compressed_sort->rows + uncompressed_path->rows); } - unsorted_chunk_path = (Path *) + chunk_path_no_sort = (Path *) create_append_path_compat(root, chunk_rel, - list_make2(unsorted_chunk_path, uncompressed_path), + list_make2(chunk_path_no_sort, uncompressed_path), NIL /* partial paths */, - NIL /* pathkeys */, + chunk_path_no_sort->pathkeys, req_outer, 0, false, false, - unsorted_chunk_path->rows + uncompressed_path->rows); + chunk_path_no_sort->rows + uncompressed_path->rows); } if (batch_merge_path != NULL) @@ -1016,12 +1029,12 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp add_path(chunk_rel, (Path *) batch_merge_path); } - if (chunk_path_with_sort_pushdown != NULL) + if (chunk_path_with_compressed_sort != NULL) { - add_path(chunk_rel, (Path *) chunk_path_with_sort_pushdown); + add_path(chunk_rel, (Path *) chunk_path_with_compressed_sort); } - if (chunk_path_with_sort_pushdown == NULL && batch_merge_path == NULL) + if (chunk_path_with_compressed_sort == NULL && batch_merge_path == NULL) { /* * Add useful sorted versions of the decompress path, if we couldn't @@ -1031,7 +1044,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp chunk_rel, ht, ht_relid, - unsorted_chunk_path, + chunk_path_no_sort, compressed_path); } @@ -1039,7 +1052,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp * This has to go after the path is copied for the ordered path since * path can get freed in add_path(). */ - add_path(chunk_rel, unsorted_chunk_path); + add_path(chunk_rel, chunk_path_no_sort); } /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed From eef6db3310d646f0fe7aa5458025e859e1a23fa9 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 3 May 2024 17:29:11 +0200 Subject: [PATCH 003/157] ref --- tsl/test/expected/vector_agg_default.out | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tsl/test/expected/vector_agg_default.out b/tsl/test/expected/vector_agg_default.out index 58e8185f7e9..fa6920b56b5 100644 --- a/tsl/test/expected/vector_agg_default.out +++ b/tsl/test/expected/vector_agg_default.out @@ -118,21 +118,17 @@ explain (costs off) select sum(c) from dvagg where a < stable_abs(1000); -- Some negative cases. explain (costs off) select sum(c) from dvagg group by grouping sets ((), (a)); - QUERY PLAN ------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------- MixedAggregate Hash Key: _hyper_1_1_chunk.a Group Key: () -> Append -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Sort - Sort Key: compress_hyper_2_2_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_2_2_chunk + -> Seq Scan on compress_hyper_2_2_chunk -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Sort - Sort Key: compress_hyper_2_4_chunk._ts_meta_sequence_num DESC - -> Seq Scan on compress_hyper_2_4_chunk -(12 rows) + -> Seq Scan on compress_hyper_2_4_chunk +(8 rows) explain (costs off) select sum(c) from dvagg having sum(c) > 0; QUERY PLAN From ca9d1c39337bc1a1a4531ae187fcff64b0d44402 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 3 May 2024 17:35:55 +0200 Subject: [PATCH 004/157] set all parameters --- tsl/src/nodes/decompress_chunk/decompress_chunk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index f8bec41718e..1b17554e840 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -879,7 +879,11 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp /* * The decompressed path already has the required ordering. */ - chunk_path_no_sort->pathkeys = root->query_pathkeys; + DecompressChunkPath *path = (DecompressChunkPath *) chunk_path_no_sort; + path->reverse = sort_info.reverse; + path->needs_sequence_num = sort_info.needs_sequence_num; + path->required_compressed_pathkeys = sort_info.required_compressed_pathkeys; + path->custom_path.path.pathkeys = root->query_pathkeys; } else { From f7b1ec50d580d0a465a6af23bd2bfed0ed3cde63 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 6 May 2024 09:16:27 +0200 Subject: [PATCH 005/157] accept the transparent_decompression ref --- .../expected/transparent_decompression-15.out | 122 ++++++++++++------ 1 file changed, 82 insertions(+), 40 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index d0bb01ee36d..dba8ce163ad 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1659,8 +1659,8 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------ Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id -> Sort (actual rows=15 loops=1) @@ -1669,8 +1669,11 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 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) + -> Sort (actual rows=1800 loops=1) + Sort Key: _hyper_1_1_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id -> Sort (actual rows=2520 loops=1) @@ -1679,9 +1682,12 @@ ORDER BY device_id; -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 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) -(20 rows) + -> Sort (actual rows=2520 loops=1) + Sort Key: _hyper_1_3_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) +(26 rows) -- test window functions with GROUP BY :PREFIX @@ -1689,8 +1695,8 @@ SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ WindowAgg (actual rows=5 loops=1) -> Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id @@ -1700,8 +1706,11 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 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) + -> Sort (actual rows=1800 loops=1) + Sort Key: _hyper_1_1_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id -> Sort (actual rows=2520 loops=1) @@ -1710,9 +1719,12 @@ ORDER BY device_id; -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 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) -(21 rows) + -> Sort (actual rows=2520 loops=1) + Sort Key: _hyper_1_3_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) +(27 rows) SET enable_hashagg = ON; -- test CTE @@ -5825,8 +5837,8 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id -> Sort (actual rows=15 loops=1) @@ -5835,16 +5847,25 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 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) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 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) + -> Sort (actual rows=1080 loops=1) + Sort Key: _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 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) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_2_6_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Sort (actual rows=504 loops=1) @@ -5865,19 +5886,25 @@ ORDER BY device_id; -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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) + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_10_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 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) + -> Sort (actual rows=1512 loops=1) + Sort Key: _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) -(50 rows) +(65 rows) -- test window functions with GROUP BY :PREFIX @@ -5885,8 +5912,8 @@ SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------- WindowAgg (actual rows=5 loops=1) -> Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id @@ -5896,16 +5923,25 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 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) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 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) + -> Sort (actual rows=1080 loops=1) + Sort Key: _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 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) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_2_6_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Sort (actual rows=504 loops=1) @@ -5926,19 +5962,25 @@ ORDER BY device_id; -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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) + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_10_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 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) + -> Sort (actual rows=1512 loops=1) + Sort Key: _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) -(51 rows) +(66 rows) SET enable_hashagg = ON; -- test CTE From 848c6eefcf419cdcfa5ab177abd003a7cf0f2c4c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 6 May 2024 19:15:01 +0200 Subject: [PATCH 006/157] simplify? --- .../nodes/decompress_chunk/decompress_chunk.c | 212 +++++++++--------- 1 file changed, 101 insertions(+), 111 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 1b17554e840..e33bdc04007 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -633,24 +633,27 @@ can_batch_sorted_merge(PlannerInfo *root, CompressionInfo *info, Chunk *chunk) * directly under the gather (merge) node and the per-chunk sorting are not used in parallel plans. * To save planning time, we therefore refrain from adding them. */ -static void -add_chunk_sorted_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hypertable *ht, Index ht_relid, +static Path * +make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Hypertable *ht, Index ht_relid, Path *path, Path *compressed_path) { if (root->query_pathkeys == NIL) - return; + { + return NULL; + } /* We are only interested in regular (i.e., non index) paths */ if (!IsA(compressed_path, Path)) - return; + { + return NULL; + } /* Copy the decompress chunk path because the original can be recycled in add_path, and our * sorted path must be independent. */ if (!ts_is_decompress_chunk_path(path)) - return; - - DecompressChunkPath *decompress_chunk_path = - copy_decompress_chunk_path((DecompressChunkPath *) path); + { + return NULL; + } /* Iterate over the sort_pathkeys and generate all possible useful sorting */ List *useful_pathkeys = NIL; @@ -661,35 +664,47 @@ add_chunk_sorted_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hypertable *ht, EquivalenceClass *pathkey_ec = pathkey->pk_eclass; if (pathkey_ec->ec_has_volatile) - return; + { + break; + } Expr *em_expr = find_em_expr_for_rel(pathkey_ec, chunk_rel); /* No em expression found for our rel */ if (!em_expr) - return; + { + break; + } /* We are only interested in sorting if this is a var */ if (!IsA(em_expr, Var)) - return; + { + break; + } useful_pathkeys = lappend(useful_pathkeys, pathkey); + } - /* Create the sorted path for these useful_pathkeys */ - if (!pathkeys_contained_in(useful_pathkeys, - decompress_chunk_path->custom_path.path.pathkeys)) - { - Path *sorted_path = - (Path *) create_sort_path(root, - chunk_rel, - &decompress_chunk_path->custom_path.path, - list_copy(useful_pathkeys), /* useful_pathkeys is modified - in each iteration */ - root->limit_tuples); - - add_path(chunk_rel, sorted_path); - } + if (useful_pathkeys == NIL) + { + return NULL; + } + + /* Create the sorted path for these useful_pathkeys */ + if (pathkeys_contained_in(useful_pathkeys, path->pathkeys)) + { + return NULL; } + + DecompressChunkPath *path_copy = copy_decompress_chunk_path((DecompressChunkPath *) path); + + Path *sorted_path = (Path *) + create_sort_path(root, chunk_rel, (Path *) path_copy, useful_pathkeys, root->limit_tuples); + +// fprintf(stderr, "made useful sorted path:\n"); +// my_print(sorted_path); + + return sorted_path; } void @@ -860,10 +875,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp Path *chunk_path_no_sort = (Path *) decompress_chunk_path_create(root, compression_info, 0, compressed_path); - - Path *batch_merge_path = NULL; - - Path *chunk_path_with_compressed_sort = NULL; + List *chunk_paths = list_make1(chunk_path_no_sort); /* * If we can push down the sort below the DecompressChunk node, we set the pathkeys of @@ -918,7 +930,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp cost_decompress_chunk(root, &path_copy->custom_path.path, &sort_path); - chunk_path_with_compressed_sort = (Path *) path_copy; + chunk_paths = lappend(chunk_paths, path_copy); } } else if (ts_guc_enable_decompression_sorted_merge) @@ -948,16 +960,39 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp path_copy->custom_path.path.pathkeys = root->query_pathkeys; cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); - batch_merge_path = (Path *) path_copy; + chunk_paths = lappend(chunk_paths, path_copy); } } /* - * If this is a partially compressed chunk we have to combine data - * from compressed and uncompressed chunk. + * Add useful sorted versions of the decompress path, if we couldn't + * push down the sort. */ - if (add_uncompressed_part) + Path *sort_above_chunk = make_chunk_sorted_path(root, + chunk_rel, + ht, + ht_relid, + chunk_path_no_sort, + compressed_path); + if (sort_above_chunk != NULL) { + chunk_paths = lappend(chunk_paths, sort_above_chunk); + } + + if (!add_uncompressed_part) + { + ListCell *chunk_paths_cell; + foreach (chunk_paths_cell, chunk_paths) + { + add_path(chunk_rel, lfirst(chunk_paths_cell)); + } + } + else + { + /* + * If this is a partially compressed chunk we have to combine data + * from compressed and uncompressed chunk. + */ Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); Path *uncompressed_path = get_cheapest_path_for_pathkeys(initial_pathlist, NIL, req_outer, TOTAL_COST, false); @@ -975,88 +1010,43 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp continue; } - /* - * If we were able to generate a batch merge path, create a merge append path - * that combines the result of the compressed and uncompressed part of the chunk. The - * uncompressed part will be sorted, the batch_merge_path is already properly sorted. - */ - if (batch_merge_path != NULL) - { - batch_merge_path = - (Path *) create_merge_append_path_compat(root, - chunk_rel, - list_make2(batch_merge_path, - uncompressed_path), - batch_merge_path->pathkeys, - req_outer, - NIL); - } - - if (chunk_path_with_compressed_sort != NULL) + ListCell *chunk_paths_cell; + foreach (chunk_paths_cell, chunk_paths) { /* - * Ideally, we would like for this to be a MergeAppend path. - * However, accumulate_append_subpath will cut out MergeAppend - * and directly add its children, so we have to combine the children - * into a MergeAppend node later, at the chunk append level. + * If we were able to generate a batch merge path, create a merge append path + * that combines the result of the compressed and uncompressed part of the chunk. + * The uncompressed part will be sorted, the batch_merge_path is already properly + * sorted. + */ + Path *path = lfirst(chunk_paths_cell); + // path = (Path *) create_merge_append_path_compat(root, + // chunk_rel, + // list_make2(path, + // uncompressed_path), + // path->pathkeys, + // req_outer, + // NIL); + /* + * The per-chunk append paths are going to be accumulated + * into a per-hypertable append path by + * accumulate_append_subpath(), and it will try to create + * MergeAppend paths if some child paths have pathkeys, so + * here it is enough to create a plain Append path. */ - chunk_path_with_compressed_sort = - (Path *) create_append_path_compat(root, - chunk_rel, - list_make2(chunk_path_with_compressed_sort, - uncompressed_path), - NIL /* partial paths */, - chunk_path_with_compressed_sort->pathkeys, - req_outer, - 0, - false, - false, - chunk_path_with_compressed_sort->rows + - uncompressed_path->rows); + path = (Path *) create_append_path_compat(root, + chunk_rel, + list_make2(path, uncompressed_path), + NIL /* partial paths */, + path->pathkeys, + req_outer, + 0, + false, + false, + path->rows + uncompressed_path->rows); + add_path(chunk_rel, path); } - - chunk_path_no_sort = (Path *) - create_append_path_compat(root, - chunk_rel, - list_make2(chunk_path_no_sort, uncompressed_path), - NIL /* partial paths */, - chunk_path_no_sort->pathkeys, - req_outer, - 0, - false, - false, - chunk_path_no_sort->rows + uncompressed_path->rows); - } - - if (batch_merge_path != NULL) - { - add_path(chunk_rel, (Path *) batch_merge_path); - } - - if (chunk_path_with_compressed_sort != NULL) - { - add_path(chunk_rel, (Path *) chunk_path_with_compressed_sort); } - - if (chunk_path_with_compressed_sort == NULL && batch_merge_path == NULL) - { - /* - * Add useful sorted versions of the decompress path, if we couldn't - * push down the sort. - */ - add_chunk_sorted_paths(root, - chunk_rel, - ht, - ht_relid, - chunk_path_no_sort, - compressed_path); - } - - /* - * This has to go after the path is copied for the ordered path since - * path can get freed in add_path(). - */ - add_path(chunk_rel, chunk_path_no_sort); } /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed From 397717dace673237219dc4dd6279de11802b2d6d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 13:42:22 +0200 Subject: [PATCH 007/157] tmp debug --- src/import/planner.c | 5 +++++ src/nodes/chunk_append/planner.c | 11 +++++++++++ tsl/src/nodes/decompress_chunk/decompress_chunk.c | 4 +++- tsl/src/nodes/decompress_chunk/decompress_context.h | 2 +- tsl/src/nodes/decompress_chunk/exec.c | 2 +- tsl/src/nodes/decompress_chunk/planner.c | 3 +-- .../sql/include/transparent_decompression_query.sql | 5 +++++ 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/import/planner.c b/src/import/planner.c index 430b084eed7..1fa8df2b73c 100644 --- a/src/import/planner.c +++ b/src/import/planner.c @@ -548,6 +548,11 @@ ts_make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOpera node->collations = collations; node->nullsFirst = nullsFirst; + fprintf(stderr, "ts make sort\n"); + mybt(); + my_print(node); + + return node; } diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index 500b25c245a..d61052a5d7f 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -88,6 +88,12 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List &collations, &nullsFirst); + fprintf(stderr, "required pathkeys:\n"); + my_print(pathkeys); + + fprintf(stderr, "child scan pathkeys:\n"); + my_print(path->pathkeys); + /* inject sort node if child sort order does not match desired order */ if (!pathkeys_contained_in(pathkeys, path->pathkeys)) { @@ -158,6 +164,7 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path } else { + Assert(false); child_plan->targetlist = tlist; } } @@ -372,6 +379,10 @@ make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOperator node->collations = collations; node->nullsFirst = nullsFirst; + fprintf(stderr, "make sort chunk append\n"); + mybt(); + my_print(node); + return node; } diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index e33bdc04007..41ac8c065d8 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -964,6 +964,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp } } + (void) make_chunk_sorted_path; /* * Add useful sorted versions of the decompress path, if we couldn't * push down the sort. @@ -974,6 +975,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp ht_relid, chunk_path_no_sort, compressed_path); + (void) sort_above_chunk; if (sort_above_chunk != NULL) { chunk_paths = lappend(chunk_paths, sort_above_chunk); @@ -1038,7 +1040,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp chunk_rel, list_make2(path, uncompressed_path), NIL /* partial paths */, - path->pathkeys, + NIL, // path->pathkeys, req_outer, 0, false, diff --git a/tsl/src/nodes/decompress_chunk/decompress_context.h b/tsl/src/nodes/decompress_chunk/decompress_context.h index fd9d0855bc2..c0e093a8c6f 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_context.h +++ b/tsl/src/nodes/decompress_chunk/decompress_context.h @@ -67,7 +67,7 @@ typedef struct DecompressContext List *vectorized_quals_constified; bool reverse; - bool batch_sorted_merge; /* Merge append optimization enabled */ + bool batch_sorted_merge; /* Batch sorted merge optimization enabled. */ bool enable_bulk_decompression; /* diff --git a/tsl/src/nodes/decompress_chunk/exec.c b/tsl/src/nodes/decompress_chunk/exec.c index c73b52aa443..2082f0c1819 100644 --- a/tsl/src/nodes/decompress_chunk/exec.c +++ b/tsl/src/nodes/decompress_chunk/exec.c @@ -210,7 +210,7 @@ decompress_chunk_begin(CustomScanState *node, EState *estate, int eflags) node->ss.ss_ScanTupleSlot->tts_tupleDescriptor); } } - /* Sort keys should only be present when sorted_merge_append is used */ + /* Sort keys should only be present when batch sorted merge is used. */ Assert(dcontext->batch_sorted_merge == true || list_length(chunk_state->sortinfo) == 0); /* diff --git a/tsl/src/nodes/decompress_chunk/planner.c b/tsl/src/nodes/decompress_chunk/planner.c index 01330f68171..3397cc53825 100644 --- a/tsl/src/nodes/decompress_chunk/planner.c +++ b/tsl/src/nodes/decompress_chunk/planner.c @@ -873,9 +873,8 @@ decompress_chunk_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *pat compressed_scan->plan.targetlist, uncompressed_attrs_needed); - /* Build heap sort info for sorted_merge_append */ + /* Build heap sort info for batch sorted merge. */ List *sort_options = NIL; - if (dcpath->batch_sorted_merge) { /* diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index e72a3651f1e..72bd5f4f9a7 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -30,6 +30,11 @@ WHERE device_id IN (1, 2) ORDER BY time, device_id; +select :'TEST_TABLE' = 'metrics_space' and :'PREFIX' != '' as result \gset +\if :result +select * from no_such_table; +\endif + -- test empty targetlist :PREFIX SELECT From b9755898e97fdc5e4d58239e525cd1813eccf7b2 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:15:49 +0200 Subject: [PATCH 008/157] Fix the flaky merge_append_partially_compressed test Add ANALYZE. To keep the desired MergeAppend plans, we also have to add a LIMIT everywhere so that the MergeAppend is chosen based on its lower startup cost. Otherwise the plain Sort over Append will be chosen because for small tables its cost is less. --- .../merge_append_partially_compressed-15.out | 861 +++++++++--------- .../merge_append_partially_compressed.sql.in | 68 +- 2 files changed, 469 insertions(+), 460 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-15.out b/tsl/test/expected/merge_append_partially_compressed-15.out index ee9f92d7eeb..4b2a7e16cbe 100644 --- a/tsl/test/expected/merge_append_partially_compressed-15.out +++ b/tsl/test/expected/merge_append_partially_compressed-15.out @@ -518,30 +518,11 @@ SELECT compress_chunk(i) FROM show_chunks('test1') i; _timescaledb_internal._hyper_3_7_chunk (1 row) -ANALYZE test1; -- make all the chunks partially compressed INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 02:01:00-00', 10, 20, 30, 40 ,50); +ANALYZE test1; -- tests that require resorting (pushdown below decompressChunk node cannot happen) -- requires resorting, no pushdown can happen -:PREFIX -SELECT * FROM test1 ORDER BY time DESC; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) - :PREFIX SELECT * FROM test1 ORDER BY time DESC LIMIT 10; QUERY PLAN @@ -564,162 +545,172 @@ SELECT * FROM test1 ORDER BY time DESC LIMIT 10; -- requires resorting :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) -- all these require resorting, no pushdown can happen :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) set max_parallel_workers_per_gather = 0; -- parallel plan different on Windows set enable_hashagg to off; -- different on PG13 :PREFIX -SELECT x1, x2, max(time) FROM test1 GROUP BY x1, x2, time ORDER BY time limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------- +SELECT x1, x2, max(time) FROM (SELECT * FROM test1 ORDER BY time, x1, x2 LIMIT 10) t +GROUP BY x1, x2, time ORDER BY time limit 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> GroupAggregate (actual rows=5 loops=1) Group Key: test1."time", test1.x1, test1.x2 - -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x1, test1.x2 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(16 rows) + -> Limit (actual rows=5 loops=1) + -> Result (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x1, test1.x2 + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(18 rows) reset max_parallel_workers_per_gather; reset enable_hashagg; @@ -920,34 +911,36 @@ SELECT compress_chunk(i) FROM show_chunks('test2') i; -- make them partially compressed INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test2; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -962,32 +955,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1003,32 +997,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x3; +SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1043,32 +1038,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1083,32 +1079,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x4; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, time; +SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1165,44 +1162,46 @@ SELECT compress_chunk(i) FROM show_chunks('test3') i; -- make them partially compressed INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test3; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1217,42 +1216,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1268,42 +1268,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x3; +SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1318,42 +1319,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1368,42 +1370,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x4; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, time; +SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 diff --git a/tsl/test/sql/merge_append_partially_compressed.sql.in b/tsl/test/sql/merge_append_partially_compressed.sql.in index c20535a990a..e319a28cdcc 100644 --- a/tsl/test/sql/merge_append_partially_compressed.sql.in +++ b/tsl/test/sql/merge_append_partially_compressed.sql.in @@ -65,46 +65,48 @@ INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 02:00:00-00', 2, INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 03:00:00-00', 1, 2, 4, 4, 0); SELECT compress_chunk(i) FROM show_chunks('test1') i; -ANALYZE test1; -- make all the chunks partially compressed INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 02:01:00-00', 10, 20, 30, 40 ,50); +ANALYZE test1; + -- tests that require resorting (pushdown below decompressChunk node cannot happen) -- requires resorting, no pushdown can happen :PREFIX -SELECT * FROM test1 ORDER BY time DESC; -:PREFIX SELECT * FROM test1 ORDER BY time DESC LIMIT 10; -- requires resorting :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST; +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST LIMIT 10; -- all these require resorting, no pushdown can happen :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST; +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST LIMIT 10; :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST; +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST LIMIT 10; :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST; +SELECT * FROM test1 ORDER BY time ASC NULLS LAST LIMIT 10; :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST; +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST LIMIT 10; :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST; +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST LIMIT 10; :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC; +SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC LIMIT 10; set max_parallel_workers_per_gather = 0; -- parallel plan different on Windows set enable_hashagg to off; -- different on PG13 + :PREFIX -SELECT x1, x2, max(time) FROM test1 GROUP BY x1, x2, time ORDER BY time limit 10; +SELECT x1, x2, max(time) FROM (SELECT * FROM test1 ORDER BY time, x1, x2 LIMIT 10) t +GROUP BY x1, x2, time ORDER BY time limit 10; + reset max_parallel_workers_per_gather; reset enable_hashagg; @@ -167,20 +169,22 @@ SELECT compress_chunk(i) FROM show_chunks('test2') i; INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test2; + set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3; -SELECT * FROM test2 ORDER BY x1, x2, x5, x3; -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; -SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; -- queries where sort is not pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3; -SELECT * FROM test2 ORDER BY x1, x2, x3; -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4; -SELECT * FROM test2 ORDER BY x1, x2, x5, x4; -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time; -SELECT * FROM test2 ORDER BY x1, x2, x5, time; +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; +SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; +SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; +SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; ----------------------------- -- tests with space partitioning @@ -213,18 +217,20 @@ SELECT compress_chunk(i) FROM show_chunks('test3') i; INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test3; + set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3; -SELECT * FROM test3 ORDER BY x1, x2, x5, x3; -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; -SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; -- queries where sort is not pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3; -SELECT * FROM test3 ORDER BY x1, x2, x3; -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4; -SELECT * FROM test3 ORDER BY x1, x2, x5, x4; -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time; -SELECT * FROM test3 ORDER BY x1, x2, x5, time; +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; +SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; +SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; +SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; From 76433431b4960d7e258a9d331d21f82d28a4ecd2 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:19:20 +0200 Subject: [PATCH 009/157] reference merge_append_partially_compressed-* --- .../merge_append_partially_compressed-16.out | 861 +++++++++--------- 1 file changed, 432 insertions(+), 429 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-16.out b/tsl/test/expected/merge_append_partially_compressed-16.out index ee9f92d7eeb..4b2a7e16cbe 100644 --- a/tsl/test/expected/merge_append_partially_compressed-16.out +++ b/tsl/test/expected/merge_append_partially_compressed-16.out @@ -518,30 +518,11 @@ SELECT compress_chunk(i) FROM show_chunks('test1') i; _timescaledb_internal._hyper_3_7_chunk (1 row) -ANALYZE test1; -- make all the chunks partially compressed INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 02:01:00-00', 10, 20, 30, 40 ,50); +ANALYZE test1; -- tests that require resorting (pushdown below decompressChunk node cannot happen) -- requires resorting, no pushdown can happen -:PREFIX -SELECT * FROM test1 ORDER BY time DESC; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) - :PREFIX SELECT * FROM test1 ORDER BY time DESC LIMIT 10; QUERY PLAN @@ -564,162 +545,172 @@ SELECT * FROM test1 ORDER BY time DESC LIMIT 10; -- requires resorting :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) -- all these require resorting, no pushdown can happen :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) set max_parallel_workers_per_gather = 0; -- parallel plan different on Windows set enable_hashagg to off; -- different on PG13 :PREFIX -SELECT x1, x2, max(time) FROM test1 GROUP BY x1, x2, time ORDER BY time limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------- +SELECT x1, x2, max(time) FROM (SELECT * FROM test1 ORDER BY time, x1, x2 LIMIT 10) t +GROUP BY x1, x2, time ORDER BY time limit 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> GroupAggregate (actual rows=5 loops=1) Group Key: test1."time", test1.x1, test1.x2 - -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x1, test1.x2 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(16 rows) + -> Limit (actual rows=5 loops=1) + -> Result (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x1, test1.x2 + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(18 rows) reset max_parallel_workers_per_gather; reset enable_hashagg; @@ -920,34 +911,36 @@ SELECT compress_chunk(i) FROM show_chunks('test2') i; -- make them partially compressed INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test2; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -962,32 +955,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1003,32 +997,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x3; +SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1043,32 +1038,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1083,32 +1079,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x4; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, time; +SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1165,44 +1162,46 @@ SELECT compress_chunk(i) FROM show_chunks('test3') i; -- make them partially compressed INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test3; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1217,42 +1216,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1268,42 +1268,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x3; +SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1318,42 +1319,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1368,42 +1370,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x4; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, time; +SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 From 4f5b34f729aa0950a1b8142f6d919eb3ae68fff7 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:24:32 +0200 Subject: [PATCH 010/157] reference REL_14_9-96-g162b38a068 merge_append_partially_compressed-* --- .../merge_append_partially_compressed-14.out | 858 +++++++++--------- 1 file changed, 430 insertions(+), 428 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-14.out b/tsl/test/expected/merge_append_partially_compressed-14.out index 77381c54acd..ef3326d5a9b 100644 --- a/tsl/test/expected/merge_append_partially_compressed-14.out +++ b/tsl/test/expected/merge_append_partially_compressed-14.out @@ -512,30 +512,11 @@ SELECT compress_chunk(i) FROM show_chunks('test1') i; _timescaledb_internal._hyper_3_7_chunk (1 row) -ANALYZE test1; -- make all the chunks partially compressed INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 02:01:00-00', 10, 20, 30, 40 ,50); +ANALYZE test1; -- tests that require resorting (pushdown below decompressChunk node cannot happen) -- requires resorting, no pushdown can happen -:PREFIX -SELECT * FROM test1 ORDER BY time DESC; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) - :PREFIX SELECT * FROM test1 ORDER BY time DESC LIMIT 10; QUERY PLAN @@ -558,162 +539,171 @@ SELECT * FROM test1 ORDER BY time DESC LIMIT 10; -- requires resorting :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) -- all these require resorting, no pushdown can happen :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) set max_parallel_workers_per_gather = 0; -- parallel plan different on Windows set enable_hashagg to off; -- different on PG13 :PREFIX -SELECT x1, x2, max(time) FROM test1 GROUP BY x1, x2, time ORDER BY time limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------- +SELECT x1, x2, max(time) FROM (SELECT * FROM test1 ORDER BY time, x1, x2 LIMIT 10) t +GROUP BY x1, x2, time ORDER BY time limit 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> GroupAggregate (actual rows=5 loops=1) Group Key: test1."time", test1.x1, test1.x2 - -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x1, test1.x2 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) + -> Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x1, test1.x2 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(16 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(17 rows) reset max_parallel_workers_per_gather; reset enable_hashagg; @@ -914,34 +904,36 @@ SELECT compress_chunk(i) FROM show_chunks('test2') i; -- make them partially compressed INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test2; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -956,32 +948,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -997,32 +990,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x3; +SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1037,32 +1031,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1077,32 +1072,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x4; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, time; +SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1159,44 +1155,46 @@ SELECT compress_chunk(i) FROM show_chunks('test3') i; -- make them partially compressed INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test3; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1211,42 +1209,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1262,42 +1261,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x3; +SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1312,42 +1312,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1362,42 +1363,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x4; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, time; +SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 From 68062c74e5e4abbd9ef7b9d6482e9a53298731e4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:25:18 +0200 Subject: [PATCH 011/157] reference REL_13_9 merge_append_partially_compressed-* --- .../merge_append_partially_compressed-13.out | 869 +++++++++--------- 1 file changed, 437 insertions(+), 432 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-13.out b/tsl/test/expected/merge_append_partially_compressed-13.out index 4eaeecf4c02..ef3326d5a9b 100644 --- a/tsl/test/expected/merge_append_partially_compressed-13.out +++ b/tsl/test/expected/merge_append_partially_compressed-13.out @@ -512,30 +512,11 @@ SELECT compress_chunk(i) FROM show_chunks('test1') i; _timescaledb_internal._hyper_3_7_chunk (1 row) -ANALYZE test1; -- make all the chunks partially compressed INSERT INTO test1 (time, x1, x2, x3, x4, x5) values('2000-01-01 02:01:00-00', 10, 20, 30, 40 ,50); +ANALYZE test1; -- tests that require resorting (pushdown below decompressChunk node cannot happen) -- requires resorting, no pushdown can happen -:PREFIX -SELECT * FROM test1 ORDER BY time DESC; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) - :PREFIX SELECT * FROM test1 ORDER BY time DESC LIMIT 10; QUERY PLAN @@ -558,162 +539,171 @@ SELECT * FROM test1 ORDER BY time DESC LIMIT 10; -- requires resorting :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) -- all these require resorting, no pushdown can happen :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 ASC NULLS LAST LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" DESC, test1.x3, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time DESC NULLS FIRST, x3 ASC NULLS LAST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" DESC, test1.x3, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" DESC, _hyper_3_7_chunk.x3, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST; - QUERY PLAN ---------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST; - QUERY PLAN ------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x3 DESC, test1.x4 DESC - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS LAST, x3 DESC NULLS FIRST, x4 DESC NULLS FIRST LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x3 DESC, test1.x4 DESC + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x3 DESC, _hyper_3_7_chunk.x4 DESC + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) :PREFIX -SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +SELECT * FROM test1 ORDER BY time ASC NULLS FIRST, x3 DESC NULLS LAST, x4 ASC LIMIT 10; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time" NULLS FIRST, test1.x3 DESC NULLS LAST, test1.x4 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(13 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time" NULLS FIRST, _hyper_3_7_chunk.x3 DESC NULLS LAST, _hyper_3_7_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(14 rows) set max_parallel_workers_per_gather = 0; -- parallel plan different on Windows set enable_hashagg to off; -- different on PG13 :PREFIX -SELECT x1, x2, max(time) FROM test1 GROUP BY x1, x2, time ORDER BY time limit 10; - QUERY PLAN ---------------------------------------------------------------------------------------------------------- +SELECT x1, x2, max(time) FROM (SELECT * FROM test1 ORDER BY time, x1, x2 LIMIT 10) t +GROUP BY x1, x2, time ORDER BY time limit 10; + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> GroupAggregate (actual rows=5 loops=1) Group Key: test1."time", test1.x1, test1.x2 - -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) - Order: test1."time", test1.x1, test1.x2 - -> Merge Append (actual rows=5 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) + -> Limit (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on test1 (actual rows=5 loops=1) + Order: test1."time", test1.x1, test1.x2 + -> Merge Append (actual rows=5 loops=1) Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(16 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_3_7_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_3_7_chunk."time", _hyper_3_7_chunk.x1, _hyper_3_7_chunk.x2 + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) +(17 rows) reset max_parallel_workers_per_gather; reset enable_hashagg; @@ -828,18 +818,21 @@ SELECT * FROM test1 ORDER BY x1, x2, x5, time LIMIT 10; :PREFIX SELECT * FROM test1 ORDER BY x1, x2, x5, time DESC, x3 ASC, x4 ASC LIMIT 10; -- pushdown - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=5 loops=1) -> 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_x1_x2_x5__ts_meta_sequence_num_idx on compress_hyper_4_8_chunk (actual rows=3 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_4_8_chunk.x1, compress_hyper_4_8_chunk.x2, compress_hyper_4_8_chunk.x5, compress_hyper_4_8_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan 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 -> Seq Scan on _hyper_3_7_chunk (actual rows=1 loops=1) -(9 rows) +(12 rows) :PREFIX SELECT * FROM test1 ORDER BY x1, x2, x5, time ASC, x3 DESC, x4 DESC LIMIT 10; -- pushdown @@ -911,34 +904,36 @@ SELECT compress_chunk(i) FROM show_chunks('test2') i; -- make them partially compressed INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test2 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test2; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -953,32 +948,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_11_chunk.x1, compress_hyper_6_11_chunk.x2, compress_hyper_6_11_chunk.x5, compress_hyper_6_11_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x3, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: compress_hyper_6_12_chunk.x1, compress_hyper_6_12_chunk.x2, compress_hyper_6_12_chunk.x5, compress_hyper_6_12_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x3, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -994,32 +990,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x3; +SELECT * FROM test2 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1034,32 +1031,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x3; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, x4; +SELECT * FROM test2 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1074,32 +1072,33 @@ SELECT * FROM test2 ORDER BY x1, x2, x5, x4; Fri Dec 31 18:00:00 1999 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) - -> Sort (actual rows=4 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) - -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) -(20 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_9_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_11_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_9_chunk.x1, _hyper_5_9_chunk.x2, _hyper_5_9_chunk.x5, _hyper_5_9_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_9_chunk (actual rows=1 loops=1) + -> Sort (actual rows=4 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_5_10_chunk (actual rows=4 loops=1) + -> Seq Scan on compress_hyper_6_12_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_5_10_chunk.x1, _hyper_5_10_chunk.x2, _hyper_5_10_chunk.x5, _hyper_5_10_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_5_10_chunk (actual rows=1 loops=1) +(21 rows) -SELECT * FROM test2 ORDER BY x1, x2, x5, time; +SELECT * FROM test2 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1156,44 +1155,46 @@ SELECT compress_chunk(i) FROM show_chunks('test3') i; -- make them partially compressed INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-01 00:02:01-00', 1, 2, 1, 1, 0); INSERT INTO test3 (time, x1, x2, x3, x4, x5) values('2000-01-10 00:02:01-00', 1, 2, 1, 1, 0); +ANALYZE test3; set enable_indexscan = off; -- queries where sort is pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1208,42 +1209,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_17_chunk.x1, compress_hyper_8_17_chunk.x2, compress_hyper_8_17_chunk.x5, compress_hyper_8_17_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x3, _hyper_7_13_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Sort (actual rows=2 loops=1) - Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_18_chunk.x1, compress_hyper_8_18_chunk.x2, compress_hyper_8_18_chunk.x5, compress_hyper_8_18_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: compress_hyper_8_19_chunk.x1, compress_hyper_8_19_chunk.x2, compress_hyper_8_19_chunk.x5, compress_hyper_8_19_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) - Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x3, _hyper_7_15_chunk.x4 Sort Method: quicksort - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: compress_hyper_8_20_chunk.x1, compress_hyper_8_20_chunk.x2, compress_hyper_8_20_chunk.x5, compress_hyper_8_20_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1259,42 +1261,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x3, x4; (10 rows) -- queries where sort is not pushed down -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3; - QUERY PLAN ----------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x3 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x3; +SELECT * FROM test3 ORDER BY x1, x2, x3 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1309,42 +1312,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x3; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk.x4 + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk.x4 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, x4; +SELECT * FROM test3 ORDER BY x1, x2, x5, x4 LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 @@ -1359,42 +1363,43 @@ SELECT * FROM test3 ORDER BY x1, x2, x5, x4; Sun Jan 09 18:00:00 2000 PST | 2 | 1 | 3 | 3 | 0 (10 rows) -:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time; - QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=10 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) +:PREFIX SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=10 loops=1) + -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) - -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" - Sort Method: quicksort - -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) - -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) -(30 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_13_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_13_chunk.x1, _hyper_7_13_chunk.x2, _hyper_7_13_chunk.x5, _hyper_7_13_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_13_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_14_chunk.x1, _hyper_7_14_chunk.x2, _hyper_7_14_chunk.x5, _hyper_7_14_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_14_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_18_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_15_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_8_19_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_15_chunk.x1, _hyper_7_15_chunk.x2, _hyper_7_15_chunk.x5, _hyper_7_15_chunk."time" + Sort Method: quicksort + -> Seq Scan on _hyper_7_15_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_7_16_chunk.x1, _hyper_7_16_chunk.x2, _hyper_7_16_chunk.x5, _hyper_7_16_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_7_16_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_8_20_chunk (actual rows=1 loops=1) +(31 rows) -SELECT * FROM test3 ORDER BY x1, x2, x5, time; +SELECT * FROM test3 ORDER BY x1, x2, x5, time LIMIT 10; time | x1 | x2 | x3 | x4 | x5 ------------------------------+----+----+----+----+---- Fri Dec 31 16:00:00 1999 PST | 1 | 2 | 1 | 1 | 0 From 2767664f774905a0e5a9e1364270cf8e655333e5 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:45:42 +0200 Subject: [PATCH 012/157] Fix some flakiness in transparent_decompression test Add ANALYZE after compression. The plan changes are expected, SeqScans are preferred over IndexScans and Sort over MergeAppend for small tables. --- .../expected/transparent_decompression-15.out | 966 ++++++++++-------- tsl/test/sql/transparent_decompression.sql.in | 2 + 2 files changed, 570 insertions(+), 398 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index d0bb01ee36d..230c3e0b87f 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -145,6 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) +ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -259,16 +260,17 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -276,9 +278,10 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(19 rows) -- test expressions :PREFIX @@ -292,31 +295,32 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - 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) + 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) 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" - 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) + -> 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) -- test empty targetlist :PREFIX @@ -337,19 +341,21 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 +(12 rows) -- test targetlist not referencing columns :PREFIX @@ -372,22 +378,31 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=1368 loops=1) + QUERY PLAN +----------------------------------------------------------------------------------------- + Merge Append (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 - Sort Method: quicksort - -> Append (actual rows=1368 loops=1) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 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=1 loops=1) - Index Cond: (device_id = 1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 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=1 loops=1) - Index Cond: (device_id = 1) -(13 rows) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(22 rows) -- test order not present in targetlist :PREFIX @@ -395,41 +410,52 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=1368 loops=1) + QUERY PLAN +----------------------------------------------------------------------------------------- + Merge Append (actual rows=1368 loops=1) Sort Key: _hyper_1_1_chunk.v1 - Sort Method: quicksort - -> Append (actual rows=1368 loops=1) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 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=1 loops=1) - Index Cond: (device_id = 1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2016 + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 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=1 loops=1) - Index Cond: (device_id = 1) -(13 rows) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(22 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(12 rows) -- -- test qual pushdown @@ -770,15 +796,18 @@ 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 - -> 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) + -> 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) :PREFIX SELECT * @@ -1764,8 +1793,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) @@ -1774,8 +1803,9 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -1783,8 +1813,9 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1792,8 +1823,9 @@ 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) - -> 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) + -> 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 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 @@ -1801,9 +1833,10 @@ 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) - -> 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) + -> 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) -- test prepared statement PREPARE prep AS @@ -1811,23 +1844,25 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(16 rows) EXECUTE prep; count @@ -2074,33 +2109,28 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge 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 (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 + Sort Method: quicksort + -> Append (actual rows=0 loops=1) -> 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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 - -> 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 + -> 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 -> 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_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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(26 rows) +(21 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2142,9 +2172,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) + Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 -> 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) @@ -2152,10 +2183,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 +(19 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2166,34 +2198,28 @@ WHERE device_id_peer IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=0 loops=1) + Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=0 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) + Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) + Rows Removed by Join Filter: 13680 + -> Append (actual rows=6840 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id_peer - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id_peer) - Rows Removed by Filter: 2520 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) -(27 rows) + -> Materialize (actual rows=2 loops=6840) + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) RESET enable_hashjoin; :PREFIX_VERBOSE @@ -2207,9 +2233,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2217,10 +2244,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2270,30 +2298,25 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_1_1_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_1_1_chunk.device_id = "*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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(23 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(18 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2307,9 +2330,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2317,10 +2341,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2447,13 +2472,12 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Nested Loop (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) - 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) @@ -2468,32 +2492,41 @@ 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=1231 loops=10) - -> Append (actual rows=1368 loops=1) + -> 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) + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> 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 + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> 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) + -> 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) :PREFIX SELECT * @@ -2506,11 +2539,12 @@ FROM :TEST_TABLE m1 m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) - -> Merge Join (actual rows=100 loops=1) - Merge Cond: (m1."time" = m2."time") + -> Nested Loop (actual rows=100 loops=1) + Join Filter: (m1."time" = m2_1."time") + Rows Removed by Join Filter: 135432 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1) Order: m1."time" -> Sort (actual rows=100 loops=1) @@ -2527,24 +2561,20 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) - -> Materialize (actual rows=100 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=100 loops=1) - Order: m2."time" - -> Sort (actual rows=100 loops=1) - 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) + -> Materialize (actual rows=1355 loops=100) + -> Append (actual rows=1368 loops=1) + -> 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 + -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=504 loops=1) 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) -(36 rows) + Rows Removed by Filter: 2016 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (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 +(33 rows) :PREFIX SELECT * @@ -2653,8 +2683,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 @@ -2685,16 +2715,17 @@ 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) - -> 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) + -> 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 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Filter: (device_id = 2) +(40 rows) :PREFIX SELECT * @@ -2936,8 +2967,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) @@ -2946,23 +2977,21 @@ 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 - -> 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")) + -> 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 _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 - -> 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) + -> 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) :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) @@ -2971,9 +3000,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 - -> 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")) + -> 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 _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) @@ -2981,9 +3010,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 - -> 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")) + -> 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 (21 rows) EXECUTE param_prep (1); @@ -3265,32 +3294,60 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=2736 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Result (actual rows=2736 loops=1) - -> Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=504 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 -(23 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- + Result (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=720 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=360 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 + -> Merge Append (actual rows=1008 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=504 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Merge Append (actual rows=1008 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 +(51 rows) -- test empty targetlist :PREFIX @@ -3463,70 +3520,128 @@ FROM :TEST_TABLE WHERE v3 > 10.0 ORDER BY time, device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (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 - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=0 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=0 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=0 loops=1) + Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 + Order: metrics_space."time", metrics_space.device_id + Startup Exclusion: false + Runtime Exclusion: false + -> Merge Append (actual rows=0 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + -> Sort (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 - Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 360 - Batches Removed by Filter: 1 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> 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 + Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 360 + Batches Removed by Filter: 1 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 + -> Sort (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 - Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1080 - Batches Removed by Filter: 3 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> 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 + Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 1080 + Batches Removed by Filter: 3 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 + -> Sort (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 - Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 360 - Batches Removed by Filter: 1 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id + Sort Method: quicksort + -> 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 + Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 360 + Batches Removed by Filter: 1 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 + -> Merge Append (actual rows=0 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Sort (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=0 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 + -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1512 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=0 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 1512 + -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=0 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 + -> Merge Append (actual rows=0 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (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 - Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 - Batches Removed by Filter: 1 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + Sort Method: quicksort + -> 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 + Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 + Batches Removed by Filter: 1 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 + -> Sort (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 - Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1512 - Batches Removed by Filter: 3 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> 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 + Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 1512 + Batches Removed by Filter: 3 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 + -> Sort (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 -(61 rows) + Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=0 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 +(119 rows) -- device_id constraint should be pushed down :PREFIX @@ -5216,43 +5331,87 @@ FROM :TEST_TABLE WHERE time > '2000-01-08' ORDER BY time, device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=4195 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=4195 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=4195 loops=1) + Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 + Order: metrics_space."time", metrics_space.device_id + Startup Exclusion: false + Runtime Exclusion: false + -> Merge Append (actual rows=1675 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Sort (actual rows=335 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=335 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 + -> Sort (actual rows=1005 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=1005 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 507 + -> Sort (actual rows=335 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=335 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 + -> Merge Append (actual rows=2520 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (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 - Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - 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) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + Sort Method: quicksort + -> 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 + Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 + Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Sort (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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> 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 + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 + Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Sort (actual rows=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(34 rows) + Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=504 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(78 rows) -- should produce ordered path :PREFIX_VERBOSE @@ -5665,32 +5824,64 @@ FROM :TEST_TABLE WHERE time > '2000-01-08' ORDER BY time, device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------- - Sort (actual rows=4195 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=4195 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Seq Scan on _hyper_2_8_chunk (actual rows=1005 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 - -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - 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 (actual rows=1512 loops=1) - Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(23 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- + Custom Scan (ChunkAppend) on metrics_space (actual rows=4195 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=1675 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Sort (actual rows=335 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=335 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 + -> Sort (actual rows=1005 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=1005 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_8_chunk (actual rows=1005 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 507 + -> Sort (actual rows=335 loops=1) + Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=335 loops=1) + Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 + -> Merge Append (actual rows=2520 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Sort (actual rows=1512 loops=1) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id + Sort Method: quicksort + -> Sort (actual rows=504 loops=1) + Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(55 rows) -- test runtime exclusion -- first chunk should be excluded @@ -6344,75 +6535,54 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=0 loops=1) + Sort (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 Sort Key: _hyper_2_4_chunk."time" - -> Sort (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 - Sort Key: _hyper_2_4_chunk."time" - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=0 loops=1) -> 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_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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id_peer = 1) - -> Sort (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 - Sort Key: _hyper_2_5_chunk."time" - Sort Method: quicksort -> 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_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._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 Index Cond: (compress_hyper_6_18_chunk.device_id_peer = 1) - -> Sort (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 - Sort Key: _hyper_2_6_chunk."time" - Sort Method: quicksort -> 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_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._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 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) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk.device_id_peer = 1) - Rows Removed by Filter: 504 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk.device_id_peer = 1) - Rows Removed by Filter: 1512 - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk.device_id_peer = 1) - Rows Removed by Filter: 504 - -> Sort (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 - Sort Key: _hyper_2_10_chunk."time" - Sort Method: quicksort + -> 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) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Index Cond: (_hyper_2_7_chunk.device_id_peer = 1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Index Cond: (_hyper_2_8_chunk.device_id_peer = 1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Index Cond: (_hyper_2_9_chunk.device_id_peer = 1) -> 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_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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id_peer = 1) - -> Sort (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 - Sort Key: _hyper_2_11_chunk."time" - Sort Method: quicksort -> 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_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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk.device_id_peer = 1) - Rows Removed by Filter: 504 -(68 rows) + -> 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) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) +(47 rows) :PREFIX_VERBOSE SELECT device_id_peer diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 5103fb55e3e..fe7f9250649 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -157,6 +157,8 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_1_chunk'); SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); +ANALYZE metrics; + -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice From f0f4ebc1f40c5a373ff044b5fde2bdb72929119e Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:48:29 +0200 Subject: [PATCH 013/157] reference REL_13_9 transparent_decompression-* --- .../expected/transparent_decompression-13.out | 406 +++++++++--------- 1 file changed, 212 insertions(+), 194 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-13.out b/tsl/test/expected/transparent_decompression-13.out index f07f7ededf6..e44cbc6467d 100644 --- a/tsl/test/expected/transparent_decompression-13.out +++ b/tsl/test/expected/transparent_decompression-13.out @@ -145,6 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) +ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -259,16 +260,17 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -276,9 +278,10 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(19 rows) -- test expressions :PREFIX @@ -292,30 +295,31 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - 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) + 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) 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" - 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) + -> 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) -- test empty targetlist :PREFIX @@ -336,19 +340,21 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 +(12 rows) -- test targetlist not referencing columns :PREFIX @@ -371,22 +377,24 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(15 rows) -- test order not present in targetlist :PREFIX @@ -394,41 +402,45 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(15 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(12 rows) -- -- test qual pushdown @@ -769,15 +781,18 @@ 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 - -> 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) + -> 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) :PREFIX SELECT * @@ -1763,8 +1778,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) @@ -1773,8 +1788,9 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -1782,8 +1798,9 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1791,8 +1808,9 @@ 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) - -> 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) + -> 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 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 @@ -1800,9 +1818,10 @@ 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) - -> 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) + -> 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) -- test prepared statement PREPARE prep AS @@ -1810,23 +1829,25 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(16 rows) EXECUTE prep; count @@ -2073,33 +2094,28 @@ ORDER BY device_id_peer, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge 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 (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 + Sort Method: quicksort + -> Append (actual rows=0 loops=1) -> 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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 - -> 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 + -> 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 -> 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_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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(26 rows) +(21 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2141,9 +2157,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) + Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 -> 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) @@ -2151,10 +2168,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 +(19 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2165,34 +2183,28 @@ WHERE device_id_peer IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=0 loops=1) + Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=0 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) + Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) + Rows Removed by Join Filter: 13680 + -> Append (actual rows=6840 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id_peer - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id_peer) - Rows Removed by Filter: 2520 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) -(27 rows) + -> Materialize (actual rows=2 loops=6840) + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) RESET enable_hashjoin; :PREFIX_VERBOSE @@ -2206,9 +2218,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2216,10 +2229,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2269,30 +2283,25 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_1_1_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_1_1_chunk.device_id = "*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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(23 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(18 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2306,9 +2315,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2316,10 +2326,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2446,13 +2457,12 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Nested Loop (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) - 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) @@ -2467,32 +2477,41 @@ 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=1231 loops=10) - -> Append (actual rows=1368 loops=1) + -> 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) + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> 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 + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> 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) + -> 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) :PREFIX SELECT * @@ -2652,8 +2671,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 @@ -2684,16 +2703,17 @@ 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) - -> 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) + -> 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 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Filter: (device_id = 2) +(40 rows) :PREFIX SELECT * @@ -2935,8 +2955,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) @@ -2945,23 +2965,21 @@ 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 - -> 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")) + -> 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 _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 - -> 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) + -> 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) :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) @@ -2970,9 +2988,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 - -> 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")) + -> 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 _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) @@ -2980,9 +2998,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 - -> 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")) + -> 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 (21 rows) EXECUTE param_prep (1); From c8b1bacb8335f6bcd42808fc90431e613d65b4a1 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:49:16 +0200 Subject: [PATCH 014/157] reference REL_16_0-116-g67738dbf9c transparent_decompression-* --- .../expected/transparent_decompression-16.out | 424 +++++++++--------- 1 file changed, 222 insertions(+), 202 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index 9d14ff7b9a1..b9ebe2fc1c5 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -145,6 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) +ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -259,16 +260,17 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -276,9 +278,10 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(19 rows) -- test expressions :PREFIX @@ -292,31 +295,32 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - 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) + 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) 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" - 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) + -> 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) -- test empty targetlist :PREFIX @@ -337,19 +341,21 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 +(12 rows) -- test targetlist not referencing columns :PREFIX @@ -372,22 +378,24 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(15 rows) -- test order not present in targetlist :PREFIX @@ -395,41 +403,45 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(15 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(12 rows) -- -- test qual pushdown @@ -770,15 +782,18 @@ 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 - -> 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) + -> 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) :PREFIX SELECT * @@ -1764,8 +1779,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) @@ -1774,8 +1789,9 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -1783,8 +1799,9 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1792,8 +1809,9 @@ 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) - -> 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) + -> 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 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 @@ -1801,9 +1819,10 @@ 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) - -> 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) + -> 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) -- test prepared statement PREPARE prep AS @@ -1811,23 +1830,25 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(16 rows) EXECUTE prep; count @@ -2142,9 +2163,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) + Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 -> 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) @@ -2152,10 +2174,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 +(19 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2166,34 +2189,28 @@ WHERE device_id_peer IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=0 loops=1) + Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=0 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) + Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) + Rows Removed by Join Filter: 13680 + -> Append (actual rows=6840 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id_peer - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id_peer) - Rows Removed by Filter: 2520 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) -(27 rows) + -> Materialize (actual rows=2 loops=6840) + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) RESET enable_hashjoin; :PREFIX_VERBOSE @@ -2207,9 +2224,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2217,10 +2235,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2270,30 +2289,25 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_1_1_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_1_1_chunk.device_id = "*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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(23 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(18 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2307,9 +2321,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2317,10 +2332,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2447,13 +2463,12 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Nested Loop (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) - 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) @@ -2468,32 +2483,41 @@ 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=1231 loops=10) - -> Append (actual rows=1368 loops=1) + -> Append (actual rows=1 loops=10) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) + Filter: ("time" = m1."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: ("time" = m1."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) + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> 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 + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> 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: ("time" = m1."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: ("time" = m1."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) + -> 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) :PREFIX SELECT * @@ -2506,11 +2530,12 @@ FROM :TEST_TABLE m1 m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) - -> Merge Join (actual rows=100 loops=1) - Merge Cond: (m1."time" = m2."time") + -> Nested Loop (actual rows=100 loops=1) + Join Filter: (m1."time" = m2_1."time") + Rows Removed by Join Filter: 135432 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1) Order: m1."time" -> Sort (actual rows=100 loops=1) @@ -2527,24 +2552,20 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) - -> Materialize (actual rows=100 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=100 loops=1) - Order: m2."time" - -> Sort (actual rows=100 loops=1) - 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) + -> Materialize (actual rows=1355 loops=100) + -> Append (actual rows=1368 loops=1) + -> 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 + -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=504 loops=1) 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) -(36 rows) + Rows Removed by Filter: 2016 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (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 +(33 rows) :PREFIX SELECT * @@ -2653,8 +2674,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 @@ -2685,16 +2706,17 @@ 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) - -> 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) + -> 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 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Filter: (device_id = 2) +(40 rows) :PREFIX SELECT * @@ -2936,8 +2958,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) @@ -2946,23 +2968,21 @@ 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 - -> 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")) + -> 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 _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 - -> 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) + -> 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) :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) @@ -2971,9 +2991,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 - -> 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")) + -> 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 _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) @@ -2981,9 +3001,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 - -> 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")) + -> 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 (21 rows) EXECUTE param_prep (1); From 5f2764f0f270a8b1d13065c14e9ee2bb5e0ae341 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 14:49:51 +0200 Subject: [PATCH 015/157] reference REL_14_9-96-g162b38a068 transparent_decompression-* --- .../expected/transparent_decompression-14.out | 422 +++++++++--------- 1 file changed, 221 insertions(+), 201 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 88351ab5fd3..e3558de4934 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -145,6 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) +ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -259,16 +260,17 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -276,9 +278,10 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(19 rows) -- test expressions :PREFIX @@ -292,30 +295,31 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - 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) + 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) 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" - 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) + -> 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) -- test empty targetlist :PREFIX @@ -336,19 +340,21 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) + Filter: (device_id < 0) + Rows Removed by Filter: 5 +(12 rows) -- test targetlist not referencing columns :PREFIX @@ -371,22 +377,24 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(15 rows) -- test order not present in targetlist :PREFIX @@ -394,41 +402,45 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(15 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(12 rows) -- -- test qual pushdown @@ -769,15 +781,18 @@ 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 - -> 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) + -> 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) :PREFIX SELECT * @@ -1763,8 +1778,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) @@ -1773,8 +1788,9 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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 @@ -1782,8 +1798,9 @@ 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> Materialize (actual rows=1368 loops=1) -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) Order: metrics_1."time" @@ -1791,8 +1808,9 @@ 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) - -> 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) + -> 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 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 @@ -1800,9 +1818,10 @@ 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) - -> 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) + -> 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) -- test prepared statement PREPARE prep AS @@ -1810,23 +1829,25 @@ 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) - -> 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 compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 -> 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(16 rows) EXECUTE prep; count @@ -2141,9 +2162,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id_peer = 1) + Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 -> 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) @@ -2151,10 +2173,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=0 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) + Rows Removed by Filter: 5 +(19 rows) --with multiple values can get a nested loop. :PREFIX_VERBOSE @@ -2165,34 +2188,28 @@ WHERE device_id_peer IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=0 loops=1) + Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=0 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=0 loops=2) + Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) + Rows Removed by Join Filter: 13680 + -> Append (actual rows=6840 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) Output: _hyper_1_1_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) Output: _hyper_1_2_chunk.device_id_peer - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id_peer) - Rows Removed by Filter: 2520 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=0 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id_peer = "*VALUES*".column1) -(27 rows) + -> Materialize (actual rows=2 loops=6840) + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) RESET enable_hashjoin; :PREFIX_VERBOSE @@ -2206,9 +2223,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2216,10 +2234,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. :PREFIX_VERBOSE @@ -2269,30 +2288,25 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_1_1_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_1_1_chunk.device_id = "*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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(23 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(18 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -2306,9 +2320,10 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = 1) + Filter: (compress_hyper_5_15_chunk.device_id = 1) + Rows Removed by Filter: 4 -> 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) @@ -2316,10 +2331,11 @@ 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 - -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = 1) -(17 rows) + Filter: (compress_hyper_5_16_chunk.device_id = 1) + Rows Removed by Filter: 4 +(19 rows) :PREFIX_VERBOSE SELECT device_id_peer @@ -2446,13 +2462,12 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Nested Loop (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) - 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) @@ -2467,32 +2482,41 @@ 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=1231 loops=10) - -> Append (actual rows=1368 loops=1) + -> 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) + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) - -> 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 + -> 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 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) - -> 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) + -> 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) :PREFIX SELECT * @@ -2505,11 +2529,12 @@ FROM :TEST_TABLE m1 m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) - -> Merge Join (actual rows=100 loops=1) - Merge Cond: (m1."time" = m2."time") + -> Nested Loop (actual rows=100 loops=1) + Join Filter: (m1."time" = m2_1."time") + Rows Removed by Join Filter: 135432 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1) Order: m1."time" -> Sort (actual rows=100 loops=1) @@ -2526,24 +2551,20 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) - -> Materialize (actual rows=100 loops=1) - -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=100 loops=1) - Order: m2."time" - -> Sort (actual rows=100 loops=1) - 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) + -> Materialize (actual rows=1355 loops=100) + -> Append (actual rows=1368 loops=1) + -> 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 + -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=504 loops=1) 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) -(36 rows) + Rows Removed by Filter: 2016 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (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 +(33 rows) :PREFIX SELECT * @@ -2652,8 +2673,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 @@ -2684,16 +2705,17 @@ 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) - -> 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) + -> 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 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) - -> 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) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (never executed) + Filter: (device_id = 2) +(40 rows) :PREFIX SELECT * @@ -2935,8 +2957,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) @@ -2945,23 +2967,21 @@ 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 - -> 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")) + -> 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 _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 - -> 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) + -> 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) :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) @@ -2970,9 +2990,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 - -> 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")) + -> 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 _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) @@ -2980,9 +3000,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 - -> 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")) + -> 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 (21 rows) EXECUTE param_prep (1); From 06c087b819c7149a87c23a91e8591646d4d63b92 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 15:05:51 +0200 Subject: [PATCH 016/157] add vacuum as well --- .../expected/transparent_decompression-15.out | 108 ++++++++---------- tsl/test/sql/transparent_decompression.sql.in | 4 +- 2 files changed, 51 insertions(+), 61 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 230c3e0b87f..fad08d543fb 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -125,7 +125,7 @@ SELECT time, NULL FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on uncompressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' @@ -145,7 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) -ANALYZE metrics; +VACUUM ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -2091,7 +2091,7 @@ ORDER BY device_id; Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> 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 + Heap Fetches: 0 -> 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 @@ -2948,7 +2948,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only 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") - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -5189,7 +5189,7 @@ LIMIT 10; -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_12_chunk."time" DESC -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=3 loops=1) - Heap Fetches: 3 + Heap Fetches: 0 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort @@ -5302,11 +5302,11 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort @@ -5318,7 +5318,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (36 rows) -- @@ -5476,15 +5476,15 @@ LIMIT 100; -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk."time" Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk."time" Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _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."time" Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5510,7 +5510,7 @@ LIMIT 100; -> 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=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk."time" Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- test ordering only by segmentby columns @@ -5532,15 +5532,15 @@ LIMIT 100; -> 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 (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5566,7 +5566,7 @@ LIMIT 100; -> 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 (actual rows=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- should produce ordered path @@ -5587,15 +5587,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5613,7 +5613,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should produce ordered path @@ -5636,15 +5636,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5662,7 +5662,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should not produce ordered path @@ -6332,9 +6332,10 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Filter: (_hyper_2_7_chunk.device_id = 1) + Index Cond: (_hyper_2_7_chunk.device_id = 1) + Heap Fetches: 0 -> Sort (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" @@ -6345,7 +6346,7 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) -(25 rows) +(26 rows) -- globs should not plan IndexOnlyScans :PREFIX_VERBOSE @@ -6437,7 +6438,7 @@ ORDER BY device_id; -> 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) - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6466,7 +6467,7 @@ WHERE device_id = 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) Index Cond: (_hyper_2_7_chunk.device_id = 1) - Heap Fetches: 504 + Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) @@ -6503,13 +6504,13 @@ ORDER BY device_id; Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> 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 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) Output: _hyper_2_8_chunk.device_id - Heap Fetches: 1512 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) Output: _hyper_2_9_chunk.device_id - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6522,7 +6523,7 @@ ORDER BY device_id; Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> 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 + Heap Fetches: 0 (39 rows) DROP INDEX tmp_idx CASCADE; @@ -6846,54 +6847,43 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_2_4_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_7_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - Index Cond: (_hyper_2_8_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_12_chunk.device_id = "*VALUES*".column1) -(47 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(36 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -7884,7 +7874,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m1_5 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 @@ -7930,7 +7920,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -7953,7 +7943,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index fe7f9250649..59d61282470 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -132,7 +132,7 @@ SELECT time, FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on uncompressed hypertable and store result \set PREFIX '' @@ -157,7 +157,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_1_chunk'); SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); -ANALYZE metrics; +VACUUM ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice From 5d44042050eeb74e957336c4705d0d0fe07e8623 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 15:08:33 +0200 Subject: [PATCH 017/157] reference REL_16_1 transparent_decompression-* --- .../expected/transparent_decompression-16.out | 108 ++++++++---------- 1 file changed, 49 insertions(+), 59 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index b9ebe2fc1c5..3a75c79797f 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -125,7 +125,7 @@ SELECT time, NULL FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on uncompressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' @@ -145,7 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) -ANALYZE metrics; +VACUUM ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -2077,7 +2077,7 @@ ORDER BY device_id; Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> 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 + Heap Fetches: 0 -> 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 @@ -2939,7 +2939,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only 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") - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -5094,7 +5094,7 @@ LIMIT 10; -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_12_chunk."time" DESC -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=3 loops=1) - Heap Fetches: 3 + Heap Fetches: 0 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort @@ -5207,11 +5207,11 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort @@ -5223,7 +5223,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (36 rows) -- @@ -5337,15 +5337,15 @@ LIMIT 100; -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk."time" Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk."time" Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _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."time" Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5371,7 +5371,7 @@ LIMIT 100; -> 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=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk."time" Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- test ordering only by segmentby columns @@ -5393,15 +5393,15 @@ LIMIT 100; -> 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 (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5427,7 +5427,7 @@ LIMIT 100; -> 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 (actual rows=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- should produce ordered path @@ -5448,15 +5448,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5474,7 +5474,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should produce ordered path @@ -5497,15 +5497,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5523,7 +5523,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should not produce ordered path @@ -6161,9 +6161,10 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Filter: (_hyper_2_7_chunk.device_id = 1) + Index Cond: (_hyper_2_7_chunk.device_id = 1) + Heap Fetches: 0 -> Sort (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" @@ -6174,7 +6175,7 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) -(25 rows) +(26 rows) -- globs should not plan IndexOnlyScans :PREFIX_VERBOSE @@ -6266,7 +6267,7 @@ ORDER BY device_id; -> 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) - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6295,7 +6296,7 @@ WHERE device_id = 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) Index Cond: (_hyper_2_7_chunk.device_id = 1) - Heap Fetches: 504 + Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) @@ -6332,13 +6333,13 @@ ORDER BY device_id; Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> 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 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) Output: _hyper_2_8_chunk.device_id - Heap Fetches: 1512 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) Output: _hyper_2_9_chunk.device_id - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6351,7 +6352,7 @@ ORDER BY device_id; Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> 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 + Heap Fetches: 0 (39 rows) DROP INDEX tmp_idx CASCADE; @@ -6696,54 +6697,43 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_2_4_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_7_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - Index Cond: (_hyper_2_8_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_12_chunk.device_id = "*VALUES*".column1) -(47 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(36 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -7734,7 +7724,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m1_5 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 @@ -7780,7 +7770,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -7803,7 +7793,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 From 3476da55ab4e3f0c0102bd0f2aaf14be5c5c6b02 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 15:12:04 +0200 Subject: [PATCH 018/157] reference REL_14_11 transparent_decompression-* --- .../expected/transparent_decompression-14.out | 108 ++++++++---------- 1 file changed, 49 insertions(+), 59 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index e3558de4934..6eb8c361070 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -125,7 +125,7 @@ SELECT time, NULL FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on uncompressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' @@ -145,7 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) -ANALYZE metrics; +VACUUM ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -2076,7 +2076,7 @@ ORDER BY device_id; Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> 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 + Heap Fetches: 0 -> 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 @@ -2938,7 +2938,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only 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") - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -5120,7 +5120,7 @@ LIMIT 10; -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_12_chunk."time" DESC -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=3 loops=1) - Heap Fetches: 3 + Heap Fetches: 0 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort @@ -5233,11 +5233,11 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort @@ -5249,7 +5249,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (36 rows) -- @@ -5363,15 +5363,15 @@ LIMIT 100; -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk."time" Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk."time" Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _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."time" Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5397,7 +5397,7 @@ LIMIT 100; -> 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=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk."time" Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- test ordering only by segmentby columns @@ -5419,15 +5419,15 @@ LIMIT 100; -> 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 (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5453,7 +5453,7 @@ LIMIT 100; -> 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 (actual rows=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- should produce ordered path @@ -5474,15 +5474,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5500,7 +5500,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should produce ordered path @@ -5523,15 +5523,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5549,7 +5549,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should not produce ordered path @@ -6187,9 +6187,10 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Filter: (_hyper_2_7_chunk.device_id = 1) + Index Cond: (_hyper_2_7_chunk.device_id = 1) + Heap Fetches: 0 -> Sort (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" @@ -6200,7 +6201,7 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) -(25 rows) +(26 rows) -- globs should not plan IndexOnlyScans :PREFIX_VERBOSE @@ -6292,7 +6293,7 @@ ORDER BY device_id; -> 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) - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6321,7 +6322,7 @@ WHERE device_id = 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) Index Cond: (_hyper_2_7_chunk.device_id = 1) - Heap Fetches: 504 + Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) @@ -6358,13 +6359,13 @@ ORDER BY device_id; Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> 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 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) Output: _hyper_2_8_chunk.device_id - Heap Fetches: 1512 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) Output: _hyper_2_9_chunk.device_id - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6377,7 +6378,7 @@ ORDER BY device_id; Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> 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 + Heap Fetches: 0 (39 rows) DROP INDEX tmp_idx CASCADE; @@ -6722,54 +6723,43 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_2_4_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_7_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - Index Cond: (_hyper_2_8_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_12_chunk.device_id = "*VALUES*".column1) -(47 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(36 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -7760,7 +7750,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m1_5 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 @@ -7806,7 +7796,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -7829,7 +7819,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 From 5ffd24abcc40c2bf4c64aad9592c96447e241380 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 15:12:56 +0200 Subject: [PATCH 019/157] reference REL_13_9 transparent_decompression-* --- .../expected/transparent_decompression-13.out | 108 ++++++++---------- 1 file changed, 49 insertions(+), 59 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-13.out b/tsl/test/expected/transparent_decompression-13.out index e44cbc6467d..1654bdda34b 100644 --- a/tsl/test/expected/transparent_decompression-13.out +++ b/tsl/test/expected/transparent_decompression-13.out @@ -125,7 +125,7 @@ SELECT time, NULL FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on uncompressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' @@ -145,7 +145,7 @@ SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); _timescaledb_internal._hyper_1_3_chunk (1 row) -ANALYZE metrics; +VACUUM ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); @@ -2076,7 +2076,7 @@ ORDER BY device_id; Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> 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 + Heap Fetches: 0 -> 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 @@ -2936,7 +2936,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only 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") - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -5118,7 +5118,7 @@ LIMIT 10; -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_12_chunk."time" DESC -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=3 loops=1) - Heap Fetches: 3 + Heap Fetches: 0 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort @@ -5231,11 +5231,11 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_time_idx on _hyper_2_9_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort @@ -5247,7 +5247,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) - Heap Fetches: 1 + Heap Fetches: 0 (36 rows) -- @@ -5361,15 +5361,15 @@ LIMIT 100; -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk."time" Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk."time" Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _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."time" Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5395,7 +5395,7 @@ LIMIT 100; -> 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=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk."time" Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- test ordering only by segmentby columns @@ -5417,15 +5417,15 @@ LIMIT 100; -> 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 (actual rows=100 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 100 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1 loops=1) Output: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk.device_id_peer Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5451,7 +5451,7 @@ LIMIT 100; -> 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 (actual rows=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1 + Heap Fetches: 0 (42 rows) -- should produce ordered path @@ -5472,15 +5472,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5498,7 +5498,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should produce ordered path @@ -5521,15 +5521,15 @@ ORDER BY device_id, -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 1005 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 335 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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) @@ -5547,7 +5547,7 @@ ORDER BY device_id, -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Heap Fetches: 504 + Heap Fetches: 0 (32 rows) -- should not produce ordered path @@ -6185,9 +6185,10 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Filter: (_hyper_2_7_chunk.device_id = 1) + Index Cond: (_hyper_2_7_chunk.device_id = 1) + Heap Fetches: 0 -> Sort (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" @@ -6198,7 +6199,7 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) -(25 rows) +(26 rows) -- globs should not plan IndexOnlyScans :PREFIX_VERBOSE @@ -6290,7 +6291,7 @@ ORDER BY device_id; -> 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) - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6319,7 +6320,7 @@ WHERE device_id = 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) Index Cond: (_hyper_2_7_chunk.device_id = 1) - Heap Fetches: 504 + Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) @@ -6356,13 +6357,13 @@ ORDER BY device_id; Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> 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 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) Output: _hyper_2_8_chunk.device_id - Heap Fetches: 1512 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) Output: _hyper_2_9_chunk.device_id - Heap Fetches: 504 + Heap Fetches: 0 -> 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 @@ -6375,7 +6376,7 @@ ORDER BY device_id; Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> 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 + Heap Fetches: 0 (39 rows) DROP INDEX tmp_idx CASCADE; @@ -6699,54 +6700,43 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop + Hash Semi Join Output: _hyper_2_4_chunk.device_id_peer - -> Unique - Output: "*VALUES*".column1 - -> Sort - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - -> Values Scan on "*VALUES*" - Output: "*VALUES*".column1 + Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_18_chunk Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_19_chunk Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_7_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - Index Cond: (_hyper_2_8_chunk.device_id = "*VALUES*".column1) - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - 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 + -> 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 - Index Cond: (_hyper_2_12_chunk.device_id = "*VALUES*".column1) -(47 rows) + -> Hash + Output: "*VALUES*".column1 + -> Values Scan on "*VALUES*" + Output: "*VALUES*".column1 +(36 rows) RESET seq_page_cost; :PREFIX_VERBOSE @@ -7770,7 +7760,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (actual rows=1 loops=7) Index Cond: ("time" = g."time") - Heap Fetches: 7 + Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk m1_5 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 @@ -7816,7 +7806,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 @@ -7839,7 +7829,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) - Heap Fetches: 7 + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") Rows Removed by Filter: 240 From 0951fb0e8e513688127050414c84bca19947246e Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 15:40:18 +0200 Subject: [PATCH 020/157] Remove unneeded Sort over Sort We would add extra Sort nodes when adjusting the children of space partitioning MergeAppend under ChunkAppend. This is not needed because MergeAppend plans add the required Sort themselves, and in general no adjustment seems to be required for the MergeAppend children specifically there. --- src/nodes/chunk_append/planner.c | 112 +-- tsl/test/expected/compression_ddl.out | 16 +- .../expected/transparent_decompression-15.out | 878 ++++++------------ 3 files changed, 330 insertions(+), 676 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index 500b25c245a..a02564c401b 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -66,16 +66,12 @@ static Plan * adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List *tlist, AttrNumber *sortColIdx) { - AppendRelInfo *appinfo = ts_get_appendrelinfo(root, path->parent->relid, false); int childSortCols; Oid *sortOperators; Oid *collations; bool *nullsFirst; AttrNumber *childColIdx; - /* push down targetlist to children */ - plan->targetlist = castNode(List, adjust_appendrel_attrs(root, (Node *) tlist, 1, &appinfo)); - /* Compute sort column info, and adjust subplan's tlist as needed */ plan = ts_prepare_sort_from_pathkeys(plan, pathkeys, @@ -138,31 +134,32 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path cscan->scan.plan.targetlist = tlist; - if (path->path.pathkeys == NIL) + ListCell *lc_plan, *lc_path; + forboth (lc_path, path->custom_paths, lc_plan, custom_plans) { - ListCell *lc_plan, *lc_path; - forboth (lc_path, path->custom_paths, lc_plan, custom_plans) - { - Plan *child_plan = lfirst(lc_plan); - Path *child_path = lfirst(lc_path); + Plan *child_plan = lfirst(lc_plan); + Path *child_path = lfirst(lc_path); - /* push down targetlist to children */ - if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) - { - /* if this is an append child we need to adjust targetlist references */ - AppendRelInfo *appinfo = - ts_get_appendrelinfo(root, child_path->parent->relid, false); + /* push down targetlist to children */ + /* if this is an append child we need to adjust targetlist references */ + if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) + { + AppendRelInfo *appinfo = ts_get_appendrelinfo(root, child_path->parent->relid, false); - child_plan->targetlist = - castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); - } - else - { - child_plan->targetlist = tlist; - } + child_plan->targetlist = + castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); + } + else + { + /* + * This can also be a MergeAppend path building the entire + * hypertable, in case we have a single partial chunk. + */ + child_plan->targetlist = tlist; } } - else + + if (path->path.pathkeys != NIL) { /* * If this is an ordered append node we need to ensure the columns @@ -170,7 +167,6 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path * return sorted output. Children not returning sorted output will be * wrapped in a sort node. */ - ListCell *lc_plan, *lc_path; int numCols; AttrNumber *sortColIdx; Oid *sortOperators; @@ -217,66 +213,16 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path */ if (IsA(lfirst(lc_plan), Result) && castNode(Result, lfirst(lc_plan))->resconstantqual == NULL) - lfirst(lc_plan) = ((Plan *) lfirst(lc_plan))->lefttree; - - /* - * This could be a MergeAppend due to space partitioning, or - * due to partially compressed chunks. In the second case, there is - * no need to inject sort nodes - */ - if (IsA(lfirst(lc_plan), MergeAppend)) { - ListCell *lc_childpath, *lc_childplan; - MergeAppend *merge_plan = castNode(MergeAppend, lfirst(lc_plan)); - MergeAppendPath *merge_path = castNode(MergeAppendPath, lfirst(lc_path)); - Index current_group_relid = - ((Path *) linitial(merge_path->subpaths))->parent->relid; - - /* - * Since for space partitioning the MergeAppend below ChunkAppend - * still has the hypertable as rel we can copy sort properties and - * target list from toplevel ChunkAppend. - */ - merge_plan->plan.targetlist = cscan->scan.plan.targetlist; - merge_plan->sortColIdx = sortColIdx; - merge_plan->sortOperators = sortOperators; - merge_plan->collations = collations; - merge_plan->nullsFirst = nullsFirst; - bool partial_chunks = true; - - /* children will have same parent relid if we have partial chunks */ - foreach (lc_childpath, merge_path->subpaths) - { - Path *child = lfirst(lc_childpath); - if (child->parent->relid != current_group_relid) - partial_chunks = false; - } - - forboth (lc_childpath, merge_path->subpaths, lc_childplan, merge_plan->mergeplans) - { - /* - * Skip this invocation in the existence of partial chunks because it - * will add an unnecessary sort node, create_merge_append_plan has already - * adjusted the childscan with a sort node if required - */ - if (!partial_chunks) - lfirst(lc_childplan) = adjust_childscan(root, - lfirst(lc_childplan), - lfirst(lc_childpath), - pathkeys, - orig_tlist, - sortColIdx); - } - } - else - { - lfirst(lc_plan) = adjust_childscan(root, - lfirst(lc_plan), - lfirst(lc_path), - path->path.pathkeys, - orig_tlist, - sortColIdx); + lfirst(lc_plan) = ((Plan *) lfirst(lc_plan))->lefttree; } + + lfirst(lc_plan) = adjust_childscan(root, + lfirst(lc_plan), + lfirst(lc_path), + path->path.pathkeys, + orig_tlist, + sortColIdx); } } diff --git a/tsl/test/expected/compression_ddl.out b/tsl/test/expected/compression_ddl.out index e2a2591a869..8b09c7960a2 100644 --- a/tsl/test/expected/compression_ddl.out +++ b/tsl/test/expected/compression_ddl.out @@ -2291,10 +2291,8 @@ EXPLAIN (COSTS OFF) SELECT * FROM space_part ORDER BY time; -> Seq Scan on compress_hyper_36_141_chunk -> Sort Sort Key: _hyper_35_138_chunk."time" - -> Sort - Sort Key: _hyper_35_138_chunk."time" - -> Seq Scan on _hyper_35_138_chunk -(25 rows) + -> Seq Scan on _hyper_35_138_chunk +(23 rows) -- make other one partial too INSERT INTO space_part VALUES @@ -2320,19 +2318,15 @@ EXPLAIN (COSTS OFF) SELECT * FROM space_part ORDER BY time; -> Seq Scan on compress_hyper_36_140_chunk -> Sort Sort Key: _hyper_35_137_chunk."time" - -> Sort - Sort Key: _hyper_35_137_chunk."time" - -> Seq Scan on _hyper_35_137_chunk + -> Seq Scan on _hyper_35_137_chunk -> Custom Scan (DecompressChunk) on _hyper_35_138_chunk -> Sort Sort Key: compress_hyper_36_141_chunk._ts_meta_sequence_num DESC -> Seq Scan on compress_hyper_36_141_chunk -> Sort Sort Key: _hyper_35_138_chunk."time" - -> Sort - Sort Key: _hyper_35_138_chunk."time" - -> Seq Scan on _hyper_35_138_chunk -(30 rows) + -> Seq Scan on _hyper_35_138_chunk +(26 rows) -- test creation of unique expression index does not interfere with enabling compression -- github issue 6205 diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index fad08d543fb..b9d27dc27f7 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -2771,33 +2771,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=360 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2810,21 +2801,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) Filter: (device_id = 2) -(84 rows) +(71 rows) -- test implicit self-join :PREFIX @@ -3294,8 +3281,8 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- Result (actual rows=2736 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3319,19 +3306,13 @@ ORDER BY time, -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=504 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=504 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=504 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=504 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Merge Append (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=504 loops=1) @@ -3347,7 +3328,7 @@ ORDER BY time, -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 2 -(51 rows) +(45 rows) -- test empty targetlist :PREFIX @@ -3571,38 +3552,26 @@ ORDER BY time, Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1512 + Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 1512 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3633,15 +3602,11 @@ ORDER BY time, Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 -(119 rows) + Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 504 +(103 rows) -- device_id constraint should be pushed down :PREFIX @@ -3708,22 +3673,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3738,11 +3697,9 @@ LIMIT 10; Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id IS NOT NULL) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id IS NOT NULL) +(53 rows) :PREFIX SELECT * @@ -3751,8 +3708,8 @@ WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3784,27 +3741,18 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3824,12 +3772,9 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) -(76 rows) + -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) +(64 rows) -- test IN (Const,Const) :PREFIX @@ -3839,8 +3784,8 @@ WHERE device_id IN (1, 2) ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3863,16 +3808,12 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3885,7 +3826,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) -> Seq Scan on compress_hyper_6_21_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) -(44 rows) +(40 rows) -- test cast pushdown :PREFIX @@ -3956,30 +3897,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 504 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1512 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 1512 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 504 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3999,13 +3931,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 504 +(68 rows) :PREFIX SELECT * @@ -4043,22 +3972,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4073,11 +3996,9 @@ LIMIT 10; Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id_peer < device_id) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id_peer < device_id) +(53 rows) -- test expressions :PREFIX @@ -4328,22 +4249,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4360,11 +4275,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(61 rows) :PREFIX SELECT * @@ -4408,22 +4321,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4440,11 +4347,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(61 rows) :PREFIX SELECT * @@ -4488,22 +4393,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4520,11 +4419,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") +(61 rows) --pushdowns between order by and segment by columns :PREFIX @@ -4534,8 +4431,8 @@ WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4570,27 +4467,18 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4612,12 +4500,9 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) -(81 rows) + -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) +(69 rows) :PREFIX SELECT * @@ -4662,30 +4547,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 504 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 1512 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 1512 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 504 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4707,13 +4583,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 504 -(85 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 504 +(73 rows) :PREFIX SELECT * @@ -4754,22 +4627,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id < v0) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id < v0) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id < v0) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4786,11 +4653,9 @@ LIMIT 10; Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id < v0) -(66 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id < v0) +(58 rows) :PREFIX SELECT * @@ -4832,30 +4697,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 504 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1512 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 1512 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 504 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4875,13 +4731,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 504 +(68 rows) --pushdown between two order by column (not pushed down) :PREFIX @@ -4924,30 +4777,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 504 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1512 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 1512 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 504 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4967,13 +4811,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 504 +(68 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE @@ -5064,22 +4905,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -5096,11 +4931,9 @@ LIMIT 10; Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(68 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) +(60 rows) --functions not yet optimized :PREFIX @@ -5139,22 +4972,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" < now()) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" < now()) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" < now()) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -5169,11 +4996,9 @@ LIMIT 10; -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" < now()) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" < now()) +(53 rows) -- test sort optimization interaction :PREFIX @@ -5344,38 +5169,26 @@ ORDER BY time, Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=335 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 -> Sort (actual rows=1005 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=1005 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 507 -> Sort (actual rows=335 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=335 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=504 loops=1) @@ -5404,14 +5217,10 @@ ORDER BY time, Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(78 rows) + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(62 rows) -- should produce ordered path :PREFIX_VERBOSE @@ -5833,30 +5642,21 @@ ORDER BY time, -> Sort (actual rows=335 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=335 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 + -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 -> Sort (actual rows=1005 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=1005 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=1005 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 + -> Seq Scan on _hyper_2_8_chunk (actual rows=1005 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 507 -> Sort (actual rows=335 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=335 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 + -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 169 -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=504 loops=1) @@ -5876,12 +5676,9 @@ ORDER BY time, -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=504 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(55 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(43 rows) -- test runtime exclusion -- first chunk should be excluded @@ -5891,8 +5688,8 @@ FROM :TEST_TABLE WHERE time > '2000-01-08'::text::timestamptz ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Custom Scan (ChunkAppend) on metrics_space (actual rows=4195 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) @@ -5926,29 +5723,20 @@ ORDER BY time, -> Sort (actual rows=335 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=335 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 169 + -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) + Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + Rows Removed by Filter: 169 -> Sort (actual rows=1005 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=1005 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1005 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1005 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Sort (actual rows=335 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=335 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 169 + -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) + Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + Rows Removed by Filter: 169 -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=504 loops=1) @@ -5968,12 +5756,9 @@ ORDER BY time, -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=504 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) +(68 rows) -- test aggregate :PREFIX @@ -7034,19 +6819,13 @@ FROM :TEST_TABLE m1 Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) -> Sort (never executed) Sort Key: m1_5."time", m1_5.device_id - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) -> Sort (never executed) Sort Key: m1_6."time", m1_6.device_id - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) -> Merge Append (never executed) Sort Key: m1_7."time", m1_7.device_id -> Sort (never executed) @@ -7059,9 +6838,7 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) -> Materialize (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=10 loops=1) Order: m2."time", m2.device_id @@ -7086,19 +6863,13 @@ FROM :TEST_TABLE m1 Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) Sort Key: m2_4."time", m2_4.device_id - -> Sort (never executed) - Sort Key: m2_4."time", m2_4.device_id - -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) -> Sort (never executed) Sort Key: m2_5."time", m2_5.device_id - -> Sort (never executed) - Sort Key: m2_5."time", m2_5.device_id - -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) -> Sort (never executed) Sort Key: m2_6."time", m2_6.device_id - -> Sort (never executed) - Sort Key: m2_6."time", m2_6.device_id - -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) -> Merge Append (never executed) Sort Key: m2_7."time", m2_7.device_id -> Sort (never executed) @@ -7111,10 +6882,8 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id - -> Sort (never executed) - Sort Key: m2_9."time", m2_9.device_id - -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) -(106 rows) + -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) +(90 rows) :PREFIX SELECT * @@ -7156,19 +6925,13 @@ FROM :TEST_TABLE m1 Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) Sort Key: m2_4."time", m2_4.device_id - -> Sort (never executed) - Sort Key: m2_4."time", m2_4.device_id - -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) -> Sort (never executed) Sort Key: m2_5."time", m2_5.device_id - -> Sort (never executed) - Sort Key: m2_5."time", m2_5.device_id - -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) -> Sort (never executed) Sort Key: m2_6."time", m2_6.device_id - -> Sort (never executed) - Sort Key: m2_6."time", m2_6.device_id - -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) -> Merge Append (never executed) Sort Key: m2_7."time", m2_7.device_id -> Sort (never executed) @@ -7181,9 +6944,7 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id - -> Sort (never executed) - Sort Key: m2_9."time", m2_9.device_id - -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) -> Materialize (actual rows=49 loops=1) -> Nested Loop (actual rows=11 loops=1) Join Filter: (m1_1."time" = m3_1."time") @@ -7216,7 +6977,7 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1512 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=504 loops=1) -(88 rows) +(80 rows) :PREFIX SELECT * @@ -7358,19 +7119,13 @@ LIMIT 10; Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) -> Sort (never executed) Sort Key: m1_5."time", m1_5.device_id - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) -> Sort (never executed) Sort Key: m1_6."time", m1_6.device_id - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) -> Merge Append (never executed) Sort Key: m1_7."time", m1_7.device_id -> Sort (never executed) @@ -7383,9 +7138,7 @@ LIMIT 10; -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) -> Materialize (actual rows=50 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" @@ -7394,27 +7147,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=360 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=1080 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=360 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7424,18 +7168,14 @@ LIMIT 10; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) -(105 rows) +(84 rows) :PREFIX SELECT * @@ -7502,33 +7242,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=360 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7541,21 +7272,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) Filter: (device_id = 2) -(105 rows) +(92 rows) :PREFIX SELECT * @@ -7601,33 +7328,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=360 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7640,21 +7358,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) Filter: (device_id = 2) -(84 rows) +(71 rows) -- test implicit self-join :PREFIX From 5bbf5dfccebe72c7ef5955c653b4aa02576955ae Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 15:55:45 +0200 Subject: [PATCH 021/157] capitalization --- src/nodes/chunk_append/planner.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index a02564c401b..b1df0ae5154 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -217,6 +217,7 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path lfirst(lc_plan) = ((Plan *) lfirst(lc_plan))->lefttree; } + /* Add Sort node if needed. */ lfirst(lc_plan) = adjust_childscan(root, lfirst(lc_plan), lfirst(lc_path), From 2670505225456c8d1068ab97fa7115db8bc84809 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 16:02:08 +0200 Subject: [PATCH 022/157] add vacuum --- tsl/test/expected/transparent_decompression-15.out | 2 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index fad08d543fb..0196cbb00b0 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -195,7 +195,7 @@ FROM _timescaledb_catalog.hypertable ht 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); CREATE INDEX ON metrics_space (device_id DESC, device_id_peer DESC, v0, v1 DESC, time); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on compressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 59d61282470..317f51fb583 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -196,7 +196,7 @@ CREATE INDEX ON metrics_space (device_id, device_id_peer DESC, v0, v1 DESC, time CREATE INDEX ON metrics_space (device_id DESC, device_id_peer DESC, v0, v1 DESC, time); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on compressed hypertable and store result \set PREFIX '' From 3b62a115806102a0c890c8465fb98627666bee0d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 7 May 2024 16:03:08 +0200 Subject: [PATCH 023/157] vacuum analyze --- tsl/test/expected/transparent_decompression-13.out | 2 +- tsl/test/expected/transparent_decompression-14.out | 2 +- tsl/test/expected/transparent_decompression-16.out | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-13.out b/tsl/test/expected/transparent_decompression-13.out index 1654bdda34b..7421911fded 100644 --- a/tsl/test/expected/transparent_decompression-13.out +++ b/tsl/test/expected/transparent_decompression-13.out @@ -195,7 +195,7 @@ FROM _timescaledb_catalog.hypertable ht 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); CREATE INDEX ON metrics_space (device_id DESC, device_id_peer DESC, v0, v1 DESC, time); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on compressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 6eb8c361070..5c4f6889d6b 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -195,7 +195,7 @@ FROM _timescaledb_catalog.hypertable ht 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); CREATE INDEX ON metrics_space (device_id DESC, device_id_peer DESC, v0, v1 DESC, time); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on compressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index 3a75c79797f..797b20608bb 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -195,7 +195,7 @@ FROM _timescaledb_catalog.hypertable ht 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); CREATE INDEX ON metrics_space (device_id DESC, device_id_peer DESC, v0, v1 DESC, time); -ANALYZE metrics_space; +VACUUM ANALYZE metrics_space; -- run queries on compressed hypertable and store result \set PREFIX '' \set PREFIX_VERBOSE '' From f92a7cac37bbf76fe9b9e2009ce6be5b23c7ba31 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 8 May 2024 12:04:32 +0200 Subject: [PATCH 024/157] try to make less invasive changes to prevent unexplainable flakiness in the CI --- src/nodes/chunk_append/planner.c | 102 ++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 30 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index b1df0ae5154..7c5646d0574 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -66,12 +66,16 @@ static Plan * adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List *tlist, AttrNumber *sortColIdx) { + AppendRelInfo *appinfo = ts_get_appendrelinfo(root, path->parent->relid, false); int childSortCols; Oid *sortOperators; Oid *collations; bool *nullsFirst; AttrNumber *childColIdx; + /* push down targetlist to children */ + plan->targetlist = castNode(List, adjust_appendrel_attrs(root, (Node *) tlist, 1, &appinfo)); + /* Compute sort column info, and adjust subplan's tlist as needed */ plan = ts_prepare_sort_from_pathkeys(plan, pathkeys, @@ -134,32 +138,35 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path cscan->scan.plan.targetlist = tlist; - ListCell *lc_plan, *lc_path; - forboth (lc_path, path->custom_paths, lc_plan, custom_plans) + if (path->path.pathkeys == NIL) { - Plan *child_plan = lfirst(lc_plan); - Path *child_path = lfirst(lc_path); - - /* push down targetlist to children */ - /* if this is an append child we need to adjust targetlist references */ - if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) + ListCell *lc_plan, *lc_path; + forboth (lc_path, path->custom_paths, lc_plan, custom_plans) { - AppendRelInfo *appinfo = ts_get_appendrelinfo(root, child_path->parent->relid, false); + Plan *child_plan = lfirst(lc_plan); + Path *child_path = lfirst(lc_path); - child_plan->targetlist = - castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); - } - else - { - /* - * This can also be a MergeAppend path building the entire - * hypertable, in case we have a single partial chunk. - */ - child_plan->targetlist = tlist; + /* push down targetlist to children */ + if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) + { + /* if this is an append child we need to adjust targetlist references */ + AppendRelInfo *appinfo = + ts_get_appendrelinfo(root, child_path->parent->relid, false); + + child_plan->targetlist = + castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); + } + else + { + /* + * This can also be a MergeAppend path building the entire + * hypertable, in case we have a single partial chunk. + */ + child_plan->targetlist = tlist; + } } } - - if (path->path.pathkeys != NIL) + else { /* * If this is an ordered append node we need to ensure the columns @@ -167,6 +174,7 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path * return sorted output. Children not returning sorted output will be * wrapped in a sort node. */ + ListCell *lc_plan, *lc_path; int numCols; AttrNumber *sortColIdx; Oid *sortOperators; @@ -213,17 +221,51 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path */ if (IsA(lfirst(lc_plan), Result) && castNode(Result, lfirst(lc_plan))->resconstantqual == NULL) - { lfirst(lc_plan) = ((Plan *) lfirst(lc_plan))->lefttree; - } - /* Add Sort node if needed. */ - lfirst(lc_plan) = adjust_childscan(root, - lfirst(lc_plan), - lfirst(lc_path), - path->path.pathkeys, - orig_tlist, - sortColIdx); + /* + * This could be a MergeAppend due to space partitioning, or + * due to partially compressed chunks. In the second case, there is + * no need to inject sort nodes + */ + if (IsA(lfirst(lc_plan), MergeAppend)) + { + ListCell *lc_childpath, *lc_childplan; + MergeAppend *merge_plan = castNode(MergeAppend, lfirst(lc_plan)); + MergeAppendPath *merge_path = castNode(MergeAppendPath, lfirst(lc_path)); + + /* + * Since for space partitioning the MergeAppend below ChunkAppend + * still has the hypertable as rel we can copy sort properties and + * target list from toplevel ChunkAppend. + */ + merge_plan->plan.targetlist = cscan->scan.plan.targetlist; + merge_plan->sortColIdx = sortColIdx; + merge_plan->sortOperators = sortOperators; + merge_plan->collations = collations; + merge_plan->nullsFirst = nullsFirst; + + forboth (lc_childpath, merge_path->subpaths, lc_childplan, merge_plan->mergeplans) + { + /* push down targetlist to children */ + Path *childpath = (Path *) lfirst(lc_childpath); + Plan *childplan = (Plan *) lfirst(lc_childplan); + AppendRelInfo *appinfo = + ts_get_appendrelinfo(root, childpath->parent->relid, false); + childplan->targetlist = + castNode(List, + adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); + } + } + else + { + lfirst(lc_plan) = adjust_childscan(root, + lfirst(lc_plan), + lfirst(lc_path), + path->path.pathkeys, + orig_tlist, + sortColIdx); + } } } From 0859a3a84b4424bf6e0c9cf610c0b4fd1bdd5bad Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 8 May 2024 12:46:59 +0200 Subject: [PATCH 025/157] bigger table? --- .../expected/transparent_decompression-15.out | 2251 +++++++++-------- tsl/test/sql/transparent_decompression.sql.in | 14 +- 2 files changed, 1144 insertions(+), 1121 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 4d25305a887..e27a57abca2 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -35,6 +35,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; +\set INTERVAL 10m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, device_id, @@ -43,7 +44,7 @@ SELECT time, 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', '20m') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics DROP COLUMN filler_2; @@ -55,7 +56,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics DROP COLUMN filler_3; @@ -67,7 +68,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ANALYZE metrics; -- create identical hypertable with space partitioning @@ -99,7 +100,7 @@ SELECT time, 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', '20m') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space DROP COLUMN filler_2; @@ -111,7 +112,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space DROP COLUMN filler_3; @@ -123,7 +124,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); VACUUM ANALYZE metrics_space; -- run queries on uncompressed hypertable and store result @@ -233,7 +234,7 @@ LIMIT 5; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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 -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) @@ -260,27 +261,27 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) Order: metrics."time" - -> Sort (actual rows=360 loops=1) + -> 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> 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=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> 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 = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (19 rows) -- test expressions @@ -297,29 +298,29 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------ - Result (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Result (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 (actual rows=2016 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) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 1512 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 3024 + -> Sort (actual rows=2016 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=4 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 (23 rows) -- test empty targetlist @@ -328,12 +329,12 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) -- test empty resultset @@ -350,11 +351,11 @@ WHERE device_id < 0; Rows Removed by Filter: 5 -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> 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 + Rows Removed by Filter: 10 (12 rows) -- test targetlist not referencing columns @@ -363,13 +364,13 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------ - Result (actual rows=6840 loops=1) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + Result (actual rows=13680 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (7 rows) -- test constraints not present in targetlist @@ -378,30 +379,30 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------ + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk.v1 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) + -> 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 = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (22 rows) -- test order not present in targetlist @@ -410,30 +411,30 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------ + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk.v1 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) + -> 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 = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (22 rows) -- test column with all NULL @@ -441,20 +442,20 @@ ORDER BY v1; SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 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) + Rows Removed by Filter: 4032 + -> 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 = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (12 rows) -- @@ -481,7 +482,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1800 + Rows Removed by Filter: 3600 Batches Removed by Filter: 5 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) @@ -493,7 +494,7 @@ ORDER BY time, -> Seq Scan 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.v3 > '10'::double precision) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> 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", _hyper_1_3_chunk.device_id @@ -501,10 +502,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_3_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2520 - Batches Removed by Filter: 5 + Rows Removed by Filter: 5040 + Batches Removed by Filter: 10 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (37 rows) @@ -524,7 +525,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -553,7 +554,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (device_id IS NOT NULL) -> Sort (never executed) @@ -591,14 +592,14 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 (23 rows) -- test IN (Const,Const) @@ -609,15 +610,15 @@ WHERE device_id IN (1, 2) ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 @@ -648,7 +649,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -686,14 +687,14 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 (23 rows) :PREFIX @@ -711,7 +712,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (device_id_peer < device_id) -> Sort (never executed) @@ -741,7 +742,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 3) Rows Removed by Filter: 4 @@ -772,9 +773,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 1440 + Rows Removed by Filter: 2880 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) @@ -801,7 +802,7 @@ LIMIT 10; 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 + Rows Removed by Filter: 3595 -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_5_15_chunk.device_id Sort Method: quicksort @@ -821,10 +822,10 @@ LIMIT 10; Limit (actual rows=10 loops=1) -> Sort (actual rows=10 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=15 loops=1) + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=30 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1785 + Rows Removed by Filter: 3570 -> 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) (9 rows) @@ -841,10 +842,10 @@ LIMIT 10; Limit (actual rows=10 loops=1) -> Sort (actual rows=10 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=20 loops=1) + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=35 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1780 + Rows Removed by Filter: 3565 -> 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) (9 rows) @@ -864,9 +865,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1785 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3570 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 15 + Rows Removed by Filter: 30 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) @@ -896,9 +897,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1780 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 20 + Rows Removed by Filter: 35 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) @@ -928,9 +929,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1780 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 20 + Rows Removed by Filter: 35 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) @@ -969,9 +970,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (v0 < 1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 4032 -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) @@ -1003,7 +1004,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) Filter: (v0 < device_id) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1028,7 +1029,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) Filter: (device_id < v0) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_1 > device_id) @@ -1069,7 +1070,7 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (v1 = device_id) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1077,7 +1078,7 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 (25 rows) --pushdown between two order by column (not pushed down) @@ -1098,21 +1099,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 1800 + Rows Removed by Filter: 3600 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 2520 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 5040 + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (23 rows) --pushdown of quals on order by and segment by cols anded together @@ -1137,10 +1138,10 @@ LIMIT 10; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=713 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 Vectorized Filter: (_hyper_1_1_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 @@ -1179,9 +1180,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1784 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3572 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 16 + Rows Removed by Filter: 28 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) @@ -1213,7 +1214,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) Vectorized Filter: ("time" < now()) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) @@ -1241,8 +1242,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Heap Fetches: 0 -> Sort (never executed) @@ -1266,8 +1267,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC, _hyper_1_3_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC, _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1292,17 +1293,17 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk."time" DESC Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (17 rows) -- @@ -1317,28 +1318,28 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=4195 loops=1) + Custom Scan (ChunkAppend) on public.metrics (actual rows=8395 loops=1) Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 Order: metrics."time", metrics.device_id Startup Exclusion: false Runtime Exclusion: false - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Sort (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=5040 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", _hyper_1_3_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (24 rows) @@ -1355,21 +1356,21 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 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_device_id_device_id_peer__ts_meta_idx 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1396,10 +1397,10 @@ LIMIT 100; Output: _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."time" Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _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."time" Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 + Rows Removed by Filter: 1685 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1429,10 +1430,10 @@ LIMIT 100; Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 + Rows Removed by Filter: 1685 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1455,21 +1456,21 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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_device_id_device_id_peer__ts_meta_idx 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1489,21 +1490,21 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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_device_id_device_id_peer__ts_meta_idx 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1521,20 +1522,20 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=4195 loops=1) + Sort (actual rows=8395 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 Sort Method: quicksort - -> Append (actual rows=4195 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (16 rows) @@ -1552,25 +1553,25 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=5 loops=1) + -> Sort (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, compress_hyper_5_16_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (21 rows) @@ -1587,20 +1588,20 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=4195 loops=1) + Sort (actual rows=8395 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Append (actual rows=4195 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1675 loops=1) + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (16 rows) @@ -1618,20 +1619,20 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=4195 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 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=1675 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3355 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 845 - -> Sort (actual rows=2520 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=5040 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=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (15 rows) @@ -1645,20 +1646,20 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=4195 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) Order: metrics."time", metrics.device_id Chunks excluded during startup: 1 - -> Sort (actual rows=1675 loops=1) + -> Sort (actual rows=3355 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1675 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3355 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=2520 loops=1) + -> Sort (actual rows=5040 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=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) (15 rows) @@ -1671,13 +1672,13 @@ FROM :TEST_TABLE; 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=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (10 rows) -- test aggregate with GROUP BY @@ -1688,8 +1689,8 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id -> Sort (actual rows=15 loops=1) @@ -1698,18 +1699,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=2520 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) (20 rows) -- test window functions with GROUP BY @@ -1718,8 +1719,8 @@ SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- WindowAgg (actual rows=5 loops=1) -> Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id @@ -1729,18 +1730,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=2520 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) (21 rows) SET enable_hashagg = ON; @@ -1755,23 +1756,23 @@ FROM q ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Sort (actual rows=6840 loops=1) + Sort (actual rows=13680 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=6840 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=6840 loops=1) + -> Subquery Scan on q (actual rows=13680 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=13680 loops=1) Order: metrics."time" - -> Sort (actual rows=1800 loops=1) + -> Sort (actual rows=3600 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2520 loops=1) - -> Sort (actual rows=2520 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (17 rows) -- test CTE join @@ -1793,49 +1794,49 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------- + Merge Join (actual rows=2736 loops=1) Merge Cond: (metrics."time" = metrics_1."time") - -> Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) Order: metrics."time" - -> Sort (actual rows=360 loops=1) + -> 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> 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=504 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> 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 = 1) - Rows Removed by Filter: 4 - -> Materialize (actual rows=1368 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) + Rows Removed by Filter: 8 + -> Materialize (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=2736 loops=1) Order: metrics_1."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=1008 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (41 rows) -- test prepared statement @@ -1844,60 +1845,60 @@ 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 4032 -> 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) + -> 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 = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (16 rows) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) DEALLOCATE prep; @@ -1915,30 +1916,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1952,30 +1953,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 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 = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 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=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1989,30 +1990,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Output: ((test_table_1.*)::metrics), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=720 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=1008 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - Rows Removed by Filter: 2016 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Output: ((test_table_3.*)::metrics), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2025,21 +2026,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (17 rows) @@ -2055,21 +2056,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 4032 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (22 rows) @@ -2082,20 +2083,20 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=6840 loops=1) + Merge Append (actual rows=13680 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (15 rows) @@ -2123,7 +2124,7 @@ ORDER BY device_id_peer, -> 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 + Rows Removed by Filter: 5040 -> 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 @@ -2149,7 +2150,7 @@ ORDER BY device_id_peer; -> 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) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> 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 @@ -2179,14 +2180,14 @@ WHERE device_id_peer IN ( -> 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) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 5040 -> 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) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 (19 rows) --with multiple values can get a nested loop. @@ -2201,21 +2202,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 13680 - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) + Rows Removed by Join Filter: 27360 + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 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=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=6840) + -> Materialize (actual rows=2 loops=13680) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2229,25 +2230,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. @@ -2259,7 +2260,7 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=2736 loops=1) + Nested Loop (actual rows=5472 loops=1) Output: _hyper_1_1_chunk.device_id_peer -> Unique (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2269,21 +2270,21 @@ WHERE device_id IN ( Sort Method: quicksort -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 - -> Append (actual rows=1368 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) + -> Append (actual rows=2736 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2326,25 +2327,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (19 rows) :PREFIX_VERBOSE @@ -2355,7 +2356,7 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=2736 loops=1) + Nested Loop (actual rows=5472 loops=1) Output: _hyper_1_1_chunk.device_id_peer -> Unique (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2365,21 +2366,21 @@ WHERE device_id IN ( Sort Method: quicksort -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 - -> Append (actual rows=1368 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=360 loops=2) + -> Append (actual rows=2736 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) (27 rows) @@ -2405,10 +2406,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> 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) + -> 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 = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2428,16 +2429,17 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Nested Loop (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)) -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2446,21 +2448,22 @@ 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_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) + -> 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=3600 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) :PREFIX SELECT * @@ -2483,7 +2486,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2495,7 +2498,7 @@ FROM :TEST_TABLE m1 -> 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 + Rows Removed by Filter: 647 -> 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) @@ -2503,8 +2506,8 @@ FROM :TEST_TABLE m1 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) + Rows Removed by Filter: 1008 + -> 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=2 loops=9) Index Cond: (device_id = m1.device_id) -> Materialize (actual rows=10 loops=1) -> Merge Append (actual rows=3 loops=1) @@ -2512,7 +2515,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 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 @@ -2522,10 +2525,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=1 loops=1) Sort Key: m3_3."time" Sort Method: quicksort - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=2 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 (52 rows) :PREFIX @@ -2539,18 +2542,17 @@ FROM :TEST_TABLE m1 m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) - -> Nested Loop (actual rows=100 loops=1) - Join Filter: (m1."time" = m2_1."time") - Rows Removed by Join Filter: 135432 + -> Merge Join (actual rows=100 loops=1) + Merge Cond: (m1."time" = m2."time") -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1) Order: m1."time" -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -2561,20 +2563,24 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) - -> Materialize (actual rows=1355 loops=100) - -> Append (actual rows=1368 loops=1) - -> 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 - -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=504 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=100 loops=1) + Order: m2."time" + -> Sort (actual rows=100 loops=1) + Sort Key: m2_1."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (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 -(33 rows) + -> 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) +(36 rows) :PREFIX SELECT * @@ -2597,7 +2603,7 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -2614,7 +2620,7 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -2642,13 +2648,13 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 37 + Rows Removed by Join Filter: 38 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2657,13 +2663,13 @@ LIMIT 10; 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=47 loops=1) + -> Materialize (actual rows=48 loops=1) -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=11 loops=1) Order: m2."time" -> Sort (actual rows=11 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) @@ -2699,7 +2705,7 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2714,7 +2720,7 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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 @@ -2754,7 +2760,7 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2778,7 +2784,7 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -2838,7 +2844,7 @@ LIMIT 20; -> Sort (actual rows=5 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2853,7 +2859,7 @@ LIMIT 20; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) @@ -2889,7 +2895,7 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -2904,7 +2910,7 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) @@ -2930,7 +2936,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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")) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) @@ -2938,7 +2944,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 480 -> 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")) (18 rows) @@ -2963,7 +2969,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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 _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) @@ -2971,7 +2977,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': 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 + Rows Removed by Filter: 480 -> 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) @@ -2986,7 +2992,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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 @@ -2996,10 +3002,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 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 + Rows Removed by Filter: 480 -> 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 + Rows Removed by Filter: 2 (21 rows) EXECUTE param_prep (1); @@ -3158,37 +3164,37 @@ 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) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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_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_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) + -> 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=1008 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=3024 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) + -> Append (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) 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_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + Rows Removed by Filter: 720 + -> 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=13680) 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 Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=13680) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) 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_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + Rows Removed by Filter: 1008 + -> 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=13680) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -3223,7 +3229,7 @@ LIMIT 5; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) @@ -3249,23 +3255,23 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------ + Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) Order: metrics_space."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (16 rows) @@ -3281,53 +3287,53 @@ 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_space (actual rows=2736 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------- + Result (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=720 loops=1) + -> Merge Append (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 2 - -> Merge Append (actual rows=1008 loops=1) + -> Merge Append (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=504 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1008 loops=1) Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (actual rows=1008 loops=1) + -> Merge Append (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 (45 rows) -- test empty targetlist @@ -3336,21 +3342,21 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=1512 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (15 rows) -- test empty resultset @@ -3382,11 +3388,11 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) (29 rows) @@ -3397,22 +3403,22 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=6840 loops=1) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + Result (actual rows=13680 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=1512 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (16 rows) -- test constraints not present in targetlist @@ -3421,26 +3427,26 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------- + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (19 rows) @@ -3450,26 +3456,26 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------- + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (19 rows) @@ -3478,16 +3484,16 @@ ORDER BY v1; SELECT v3 FROM :TEST_TABLE WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------- + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (9 rows) @@ -3517,7 +3523,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 Batches Removed by Filter: 1 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) @@ -3529,7 +3535,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1080 + Rows Removed by Filter: 2160 Batches Removed by Filter: 3 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) @@ -3541,7 +3547,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 Batches Removed by Filter: 1 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) @@ -3555,7 +3561,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id @@ -3563,7 +3569,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id @@ -3571,7 +3577,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3581,10 +3587,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 - Batches Removed by Filter: 1 + Rows Removed by Filter: 1008 + Batches Removed by Filter: 2 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 -> Sort (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 @@ -3593,10 +3599,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1512 - Batches Removed by Filter: 3 + Rows Removed by Filter: 3024 + Batches Removed by Filter: 6 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> Sort (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 @@ -3605,7 +3611,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 (103 rows) -- device_id constraint should be pushed down @@ -3624,7 +3630,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) @@ -3654,19 +3660,19 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id IS NOT NULL) -> Merge Append (never executed) @@ -3761,14 +3767,14 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -3794,13 +3800,13 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=5 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) Rows Removed by Filter: 2 @@ -3844,7 +3850,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) @@ -3899,19 +3905,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3920,20 +3926,20 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 (68 rows) :PREFIX @@ -3953,19 +3959,19 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id_peer < device_id) -> Merge Append (never executed) @@ -4016,7 +4022,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -4046,19 +4052,19 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 1080 + Rows Removed by Filter: 2160 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) @@ -4103,7 +4109,7 @@ LIMIT 10; Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 359 + Rows Removed by Filter: 719 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_17_chunk.device_id Sort Method: quicksort @@ -4111,7 +4117,7 @@ LIMIT 10; 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)) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1077 + Rows Removed by Filter: 2157 -> Sort (actual rows=3 loops=1) Sort Key: compress_hyper_6_18_chunk.device_id Sort Method: quicksort @@ -4119,7 +4125,7 @@ LIMIT 10; 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)) -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 359 + Rows Removed by Filter: 719 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_19_chunk.device_id Sort Method: quicksort @@ -4144,25 +4150,25 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=6 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 357 + Rows Removed by Filter: 714 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=18 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1071 + Rows Removed by Filter: 2142 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=6 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 357 + Rows Removed by Filter: 714 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (29 rows) @@ -4184,25 +4190,25 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=7 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 356 + Rows Removed by Filter: 713 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=12 loops=1) + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=21 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1068 + Rows Removed by Filter: 2139 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=7 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 356 + Rows Removed by Filter: 713 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) (29 rows) @@ -4224,25 +4230,25 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=357 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=714 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1071 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2142 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 9 + Rows Removed by Filter: 18 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=357 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=714 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) @@ -4296,25 +4302,25 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1068 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 12 + Rows Removed by Filter: 21 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) @@ -4368,25 +4374,25 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1068 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 12 + Rows Removed by Filter: 21 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) @@ -4488,7 +4494,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4496,7 +4502,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -4549,19 +4555,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4571,7 +4577,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4579,13 +4585,13 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 (73 rows) :PREFIX @@ -4605,21 +4611,21 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (device_id < v0) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) Filter: (device_id < v0) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Filter: (device_id < v0) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_1 > device_id) @@ -4676,21 +4682,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1080 + Rows Removed by Filter: 2160 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4699,19 +4705,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4719,21 +4725,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1008 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1512 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 3024 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 (68 rows) --pushdown between two order by column (not pushed down) @@ -4756,21 +4762,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1080 + Rows Removed by Filter: 2160 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 360 + Rows Removed by Filter: 720 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4779,19 +4785,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4799,21 +4805,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1008 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1512 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 3024 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + Rows Removed by Filter: 1008 (68 rows) --pushdown of quals on order by and segment by cols anded together @@ -4838,10 +4844,10 @@ LIMIT 10; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=713 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 Vectorized Filter: (_hyper_2_4_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 @@ -4878,27 +4884,27 @@ LIMIT 10; Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=6 loops=1) + -> Sort (actual rows=9 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Sort (actual rows=4 loops=1) + -> Sort (actual rows=2 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1068 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 12 + Rows Removed by Filter: 21 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Sort (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=356 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 4 + Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) @@ -4953,19 +4959,19 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Vectorized Filter: ("time" < now()) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) Vectorized Filter: ("time" < now()) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Vectorized Filter: ("time" < now()) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) @@ -5018,13 +5024,13 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5071,13 +5077,13 @@ LIMIT 10; -> Sort (actual rows=7 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC, _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC, _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5114,17 +5120,17 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk.device_id, _hyper_2_5_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk.device_id, _hyper_2_6_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) Heap Fetches: 0 @@ -5135,13 +5141,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) Heap Fetches: 0 (36 rows) @@ -5158,66 +5164,66 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=4195 loops=1) + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=8395 loops=1) Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 Order: metrics_space."time", metrics_space.device_id Startup Exclusion: false Runtime Exclusion: false - -> Merge Append (actual rows=1675 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=335 loops=1) + -> Sort (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Sort (actual rows=1005 loops=1) + Rows Removed by Filter: 337 + -> Sort (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 - -> Sort (actual rows=335 loops=1) + Rows Removed by Filter: 1011 + -> Sort (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Merge Append (actual rows=2520 loops=1) + Rows Removed by Filter: 337 + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 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 Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=3024 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 Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (62 rows) @@ -5234,32 +5240,32 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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_device_id_device_id_peer__ts_meta_idx 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) + -> 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=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (28 rows) @@ -5302,25 +5308,21 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 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, _hyper_2_11_chunk."time" Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=1 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=1 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Sort Key: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_sequence_num - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + 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=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk."time" Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 -(42 rows) +(38 rows) -- test ordering only by segmentby columns -- should produce ordered path and not have sequence number in targetlist of compressed scan @@ -5358,25 +5360,21 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=1 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=1 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Sort Key: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + 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 Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 -(42 rows) +(38 rows) -- should produce ordered path -- only referencing PREFIX_VERBOSE should work @@ -5391,35 +5389,35 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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_device_id_device_id_peer__ts_meta_idx 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) + -> 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=1008 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5440,35 +5438,35 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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_device_id_device_id_peer__ts_meta_idx 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) + -> 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=1008 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5487,38 +5485,38 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=4195 loops=1) + Sort (actual rows=8395 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time", _hyper_2_7_chunk.v3 Sort Method: quicksort - -> Append (actual rows=4195 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + Rows Removed by Filter: 337 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + Rows Removed by Filter: 1011 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 337 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5536,40 +5534,40 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=4195 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=335 loops=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=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Sort (actual rows=3 loops=1) + -> Sort (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, compress_hyper_6_21_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=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=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (36 rows) @@ -5586,38 +5584,38 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=4195 loops=1) + Sort (actual rows=8395 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Sort Method: quicksort - -> Append (actual rows=4195 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=335 loops=1) + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + Rows Removed by Filter: 337 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + Rows Removed by Filter: 1011 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 337 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5635,48 +5633,48 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=4195 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=1675 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=335 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=671 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Sort (actual rows=1005 loops=1) + Rows Removed by Filter: 337 + -> Sort (actual rows=2013 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=1005 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2013 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 507 - -> Sort (actual rows=335 loops=1) + Rows Removed by Filter: 1011 + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=671 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 169 - -> Merge Append (actual rows=2520 loops=1) + Rows Removed by Filter: 337 + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (43 rows) @@ -5690,7 +5688,7 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=4195 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id @@ -5718,47 +5716,45 @@ ORDER BY time, -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) Rows Removed by Filter: 1 - -> Merge Append (actual rows=1675 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=335 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=335 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 169 - -> Sort (actual rows=1005 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=671 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Sort (actual rows=2013 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2013 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=335 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=335 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 169 - -> Merge Append (actual rows=2520 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=671 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -(68 rows) +(66 rows) -- test aggregate :PREFIX @@ -5769,28 +5765,28 @@ FROM :TEST_TABLE; Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=1512 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (25 rows) -- test aggregate with GROUP BY @@ -5811,48 +5807,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=1512 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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_10_chunk (actual rows=1008 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 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) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (50 rows) -- test window functions with GROUP BY @@ -5872,48 +5868,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=1512 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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_10_chunk (actual rows=1008 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 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) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (51 rows) SET enable_hashagg = ON; @@ -5926,49 +5922,49 @@ SET enable_hashagg = ON; SELECT * FROM q ORDER BY v1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=6840 loops=1) + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=13680 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=6840 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=6840 loops=1) + -> Subquery Scan on q (actual rows=13680 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=13680 loops=1) Order: metrics_space."time" - -> Merge Append (actual rows=1800 loops=1) + -> Merge Append (actual rows=3600 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=2160 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Merge Append (actual rows=2520 loops=1) + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_7_chunk."time" - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=504 loops=1) - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1512 loops=1) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=504 loops=1) - -> Merge Append (actual rows=2520 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time" - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=1008 loops=1) (41 rows) -- test CTE join @@ -5990,45 +5986,45 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=1368 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------- + Merge Join (actual rows=2736 loops=1) Merge Cond: (metrics_space."time" = metrics_space_1."time") - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=1368 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) Order: metrics_space."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Materialize (actual rows=1368 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=1368 loops=1) + -> Materialize (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=2736 loops=1) Order: metrics_space_1."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1008 loops=1) Index Cond: (device_id = 2) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 (37 rows) -- test prepared statement @@ -6037,57 +6033,57 @@ 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_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (13 rows) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) EXECUTE prep; count ------- - 1368 + 2736 (1 row) DEALLOCATE prep; @@ -6105,30 +6101,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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_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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (26 rows) @@ -6142,29 +6138,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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_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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 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 Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6178,29 +6174,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=1368 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=360 loops=1) + -> Sort (actual rows=720 loops=1) Output: ((test_table_1.*)::metrics_space), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=720 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_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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk test_table_2 (actual rows=1008 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=1008 loops=1) Output: ((test_table_3.*)::metrics_space), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6213,21 +6209,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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) + -> 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=1008 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (17 rows) @@ -6243,21 +6239,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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) + -> 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=1008 loops=1) Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (22 rows) @@ -6270,43 +6266,43 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=6840 loops=1) + Merge Append (actual rows=13680 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 0 (39 rows) @@ -6476,14 +6472,14 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id_peer = 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk.device_id_peer = 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> 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) Output: _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) @@ -6502,42 +6498,42 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Join Filter: (_hyper_2_4_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 13680 - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + Rows Removed by Join Filter: 27360 + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer - -> Materialize (actual rows=2 loops=6840) + -> Materialize (actual rows=2 loops=13680) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6551,20 +6547,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6578,42 +6574,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=2736 loops=1) + Hash Semi Join (actual rows=5472 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6678,20 +6674,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6704,42 +6700,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=2736 loops=1) + Hash Semi Join (actual rows=5472 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=360 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6769,8 +6765,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -6803,17 +6799,17 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id @@ -6847,17 +6843,17 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id @@ -6895,13 +6891,11 @@ 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: (m2."time" = m1_1."time") - Join Filter: (m1_1.device_id = m2.device_id) - Rows Removed by Join Filter: 39 + Merge Cond: ((m2."time" = m1."time") AND (m2.device_id = m1.device_id)) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=10 loops=1) Order: m2."time", m2.device_id -> Merge Append (actual rows=10 loops=1) @@ -6909,17 +6903,17 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id @@ -6945,39 +6939,66 @@ FROM :TEST_TABLE m1 -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) - -> Materialize (actual rows=49 loops=1) - -> Nested Loop (actual rows=11 loops=1) - Join Filter: (m1_1."time" = m3_1."time") - Rows Removed by Join Filter: 13672 - -> Merge Append (actual rows=3 loops=1) - Sort Key: m3_1."time" - -> Sort (actual rows=3 loops=1) + -> Materialize (actual rows=10 loops=1) + -> Merge Join (actual rows=10 loops=1) + Merge Cond: (m1."time" = m3_1."time") + -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) + Order: m1."time", m1.device_id + -> Merge Append (actual rows=10 loops=1) + Sort Key: m1_1."time", m1_1.device_id + -> Sort (actual rows=3 loops=1) + Sort Key: m1_1."time", m1_1.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Sort (actual rows=6 loops=1) + Sort Key: m1_2."time", m1_2.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: m1_3."time", m1_3.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Merge Append (never executed) + Sort Key: m1_4."time", m1_4.device_id + -> Sort (never executed) + Sort Key: m1_4."time", m1_4.device_id + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Sort (never executed) + Sort Key: m1_5."time", m1_5.device_id + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Sort (never executed) + Sort Key: m1_6."time", m1_6.device_id + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Merge Append (never executed) + Sort Key: m1_7."time", m1_7.device_id + -> Sort (never executed) + Sort Key: m1_7."time", m1_7.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + -> Sort (never executed) + Sort Key: m1_8."time", m1_8.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + -> Sort (never executed) + Sort Key: m1_9."time", m1_9.device_id + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Materialize (actual rows=10 loops=1) + -> Merge Append (actual rows=3 loops=1) Sort Key: m3_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m3_3 (actual rows=1 loops=1) - Filter: (device_id = 3) - -> Materialize (actual rows=4561 loops=3) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=360 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk m1_4 (actual rows=504 loops=1) - -> Seq Scan on _hyper_2_8_chunk m1_5 (actual rows=1512 loops=1) - -> Seq Scan on _hyper_2_9_chunk m1_6 (actual rows=504 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=504 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1512 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=504 loops=1) -(80 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: m3_1."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=1 loops=1) + Filter: (device_id = 3) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) + Filter: (device_id = 3) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m3_3 (actual rows=1 loops=1) + Filter: (device_id = 3) +(105 rows) :PREFIX SELECT * @@ -7000,7 +7021,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_2 (never executed) @@ -7016,7 +7037,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -7050,7 +7071,7 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -7067,7 +7088,7 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -7095,7 +7116,7 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 40 + Rows Removed by Join Filter: 39 -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Merge Append (actual rows=10 loops=1) @@ -7103,17 +7124,17 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id @@ -7139,7 +7160,7 @@ LIMIT 10; -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) - -> Materialize (actual rows=50 loops=1) + -> Materialize (actual rows=49 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" -> Merge Append (actual rows=11 loops=1) @@ -7147,17 +7168,17 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" @@ -7206,17 +7227,17 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=61 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=21 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" @@ -7249,7 +7270,7 @@ LIMIT 100; -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -7311,7 +7332,7 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id @@ -7335,7 +7356,7 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -7397,17 +7418,17 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" @@ -7433,17 +7454,17 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" @@ -7492,17 +7513,17 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" @@ -7528,17 +7549,17 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" @@ -7575,7 +7596,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 7 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (never executed) @@ -7597,7 +7618,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) @@ -7629,7 +7650,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_17_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 Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) @@ -7637,7 +7658,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_20_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) @@ -7652,7 +7673,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) @@ -7660,7 +7681,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) (18 rows) @@ -7821,37 +7842,37 @@ 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) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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_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_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) + -> 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=1008 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=3024 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) + -> Append (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) 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_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=1 loops=6840) + Rows Removed by Filter: 720 + -> 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=13680) 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 Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=13680) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=6840) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) 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_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=6840) + Rows Removed by Filter: 1008 + -> 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=13680) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -7908,10 +7929,10 @@ $$; -> Custom Scan (ChunkAppend) on metrics_ordered (actual rows=10 loops=1) Order: metrics_ordered."time" DESC -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk (actual rows=10 loops=1) - -> Sort (actual rows=5 loops=1) + -> Sort (actual rows=6 loops=1) Sort Key: compress_hyper_12_31_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_12_31_chunk (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_12_30_chunk._ts_meta_max_1 DESC @@ -7941,30 +7962,30 @@ $$; (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) + -> Merge Append (actual rows=13680 loops=1) Sort Key: d_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=1800 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=3600 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_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_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) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=5040 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=10 loops=1) + -> Limit (actual rows=0 loops=13680) + -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=13680) Order: m."time" DESC Hypertables excluded during runtime: 0 - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=6840) - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=13680) + -> 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=13680) 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) - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=13680) + -> 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=13680) 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) - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=13680) + -> 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=13680) Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) (23 rows) @@ -8035,7 +8056,7 @@ PREPARE tableoid_prep AS SELECT tableoid::regclass FROM :TEST_TABLE WHERE device -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -9535,7 +9556,7 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------ Gather Merge - Workers Planned: 3 + Workers Planned: 4 -> Sort Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id -> Parallel Append @@ -9552,7 +9573,7 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v Finalize HashAggregate Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather - Workers Planned: 3 + Workers Planned: 4 -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") -> Result @@ -9565,19 +9586,19 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v (13 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------- Gather Merge Workers Planned: 4 -> Sort - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Parallel Append + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk + -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk -> Parallel Seq Scan on compress_hyper_6_17_chunk -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk -> Parallel Seq Scan on compress_hyper_6_19_chunk - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk - -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk -> Parallel Seq Scan on compress_hyper_6_18_chunk -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk @@ -9657,12 +9678,12 @@ $sql$; :PREFIX SELECT * FROM ht_func(); QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) \c @@ -9670,12 +9691,12 @@ $sql$; :PREFIX SELECT * FROM ht_func(); QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1800 loops=1) + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) -> Seq Scan 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) -- repro for core dump related to total_table_pages setting that get diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 317f51fb583..46eeae860c9 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -33,6 +33,8 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; +\set INTERVAL 10m + INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, device_id, @@ -41,7 +43,7 @@ SELECT time, 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', '20m') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics @@ -55,7 +57,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics @@ -69,7 +71,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ANALYZE metrics; @@ -101,7 +103,7 @@ SELECT time, 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', '20m') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space @@ -115,7 +117,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space @@ -129,7 +131,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', '20m') gtime (time), +FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); VACUUM ANALYZE metrics_space; From e509896b9c7826e0a11ef3ee05460c728b656f3c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 8 May 2024 13:00:13 +0200 Subject: [PATCH 026/157] even less changes --- src/nodes/chunk_append/planner.c | 33 +++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index 7c5646d0574..aea4aed7c9b 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -89,7 +89,7 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List &nullsFirst); /* inject sort node if child sort order does not match desired order */ - if (!pathkeys_contained_in(pathkeys, path->pathkeys)) + if (!pathkeys_contained_in(pathkeys, path->pathkeys) && !IsA(plan, Sort)) { plan = (Plan *) make_sort(plan, childSortCols, childColIdx, sortOperators, collations, nullsFirst); @@ -233,6 +233,8 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path ListCell *lc_childpath, *lc_childplan; MergeAppend *merge_plan = castNode(MergeAppend, lfirst(lc_plan)); MergeAppendPath *merge_path = castNode(MergeAppendPath, lfirst(lc_path)); + Index current_group_relid = + ((Path *) linitial(merge_path->subpaths))->parent->relid; /* * Since for space partitioning the MergeAppend below ChunkAppend @@ -244,17 +246,30 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path merge_plan->sortOperators = sortOperators; merge_plan->collations = collations; merge_plan->nullsFirst = nullsFirst; + bool partial_chunks = true; + + /* children will have same parent relid if we have partial chunks */ + foreach (lc_childpath, merge_path->subpaths) + { + Path *child = lfirst(lc_childpath); + if (child->parent->relid != current_group_relid) + partial_chunks = false; + } forboth (lc_childpath, merge_path->subpaths, lc_childplan, merge_plan->mergeplans) { - /* push down targetlist to children */ - Path *childpath = (Path *) lfirst(lc_childpath); - Plan *childplan = (Plan *) lfirst(lc_childplan); - AppendRelInfo *appinfo = - ts_get_appendrelinfo(root, childpath->parent->relid, false); - childplan->targetlist = - castNode(List, - adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); + /* + * Skip this invocation in the existence of partial chunks because it + * will add an unnecessary sort node, create_merge_append_plan has already + * adjusted the childscan with a sort node if required + */ + if (!partial_chunks) + lfirst(lc_childplan) = adjust_childscan(root, + lfirst(lc_childplan), + lfirst(lc_childpath), + pathkeys, + orig_tlist, + sortColIdx); } } else From f50947e0fb2a08750e1b75c539c24b846c69e26f Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 8 May 2024 13:48:34 +0200 Subject: [PATCH 027/157] even bigger table? --- .../expected/transparent_decompression-15.out | 2693 +++++++++-------- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 1358 insertions(+), 1337 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index e27a57abca2..87037d03278 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -35,7 +35,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 10m +\set INTERVAL 5m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, device_id, @@ -234,13 +234,13 @@ LIMIT 5; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 = 1) @@ -263,25 +263,25 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) Order: metrics."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 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) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (19 rows) -- test expressions @@ -298,44 +298,45 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------ - Result (actual rows=5472 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) + Result (actual rows=10944 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=10944 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=2880 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=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2880 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 6 + -> Sort (actual rows=4032 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=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=4032 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3024 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 6048 + -> Sort (actual rows=4032 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=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=4032 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=6 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 (23 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(6 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- + Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + Heap Fetches: 0 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) +(7 rows) -- test empty resultset :PREFIX @@ -348,30 +349,31 @@ WHERE device_id < 0; -> 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 + Rows Removed by Filter: 10 -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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: 10 + Rows Removed by Filter: 15 (12 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=13680 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(7 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- + Result (actual rows=27360 loops=1) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + Heap Fetches: 0 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) +(8 rows) -- test constraints not present in targetlist :PREFIX @@ -381,28 +383,28 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_1_1_chunk.v1 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=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_3_chunk.v1 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (22 rows) -- test order not present in targetlist @@ -413,28 +415,28 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_1_1_chunk.v1 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=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_3_chunk.v1 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (22 rows) -- test column with all NULL @@ -444,18 +446,18 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> 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) + Rows Removed by Filter: 8064 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (12 rows) -- @@ -482,10 +484,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3600 - Batches Removed by Filter: 5 + Rows Removed by Filter: 7200 + Batches Removed by Filter: 10 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> Sort (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 @@ -494,7 +496,7 @@ ORDER BY time, -> Seq Scan 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.v3 > '10'::double precision) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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", _hyper_1_3_chunk.device_id @@ -502,10 +504,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_3_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 5040 - Batches Removed by Filter: 10 + Rows Removed by Filter: 10080 + Batches Removed by Filter: 15 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (37 rows) @@ -525,10 +527,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -554,8 +556,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -586,20 +588,20 @@ LIMIT 10; -> 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 IS NULL) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 10 + Rows Removed by Filter: 15 (23 rows) -- test IN (Const,Const) @@ -618,10 +620,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2880 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -649,10 +651,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -681,20 +683,20 @@ LIMIT 10; -> 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 = device_id_peer) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 10 + Rows Removed by Filter: 15 (23 rows) :PREFIX @@ -712,8 +714,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -742,10 +744,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 3) -> Sort (never executed) @@ -773,10 +775,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2880 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 5760 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) -> Sort (never executed) @@ -802,13 +804,14 @@ LIMIT 10; 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: 3595 + Rows Removed by Filter: 4995 -> 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) + Rows Removed by Filter: 5 +(10 rows) :PREFIX SELECT * @@ -823,12 +826,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=60 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3570 + Rows Removed by Filter: 4940 -> 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) -(9 rows) + Rows Removed by Filter: 5 +(10 rows) :PREFIX SELECT * @@ -843,12 +847,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=35 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=65 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3565 + Rows Removed by Filter: 4935 -> 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) -(9 rows) + Rows Removed by Filter: 5 +(10 rows) :PREFIX SELECT * @@ -865,10 +870,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3570 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7140 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 30 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 60 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -897,10 +902,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7135 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 35 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 65 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -929,10 +934,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7135 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 35 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 65 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -966,13 +971,13 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (v0 < 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) @@ -1000,11 +1005,11 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) Filter: (v0 < device_id) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1029,9 +1034,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1064,13 +1069,13 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 -> Sort (actual rows=0 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=0 loops=1) Filter: (v1 = device_id) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1078,7 +1083,7 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 10 + Rows Removed by Filter: 15 (25 rows) --pushdown between two order by column (not pushed down) @@ -1099,21 +1104,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 3600 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 7200 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 5040 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 10080 + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) (23 rows) --pushdown of quals on order by and segment by cols anded together @@ -1138,15 +1143,15 @@ LIMIT 10; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1427 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 Vectorized Filter: (_hyper_1_1_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 + Rows Removed by Filter: 13 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: ((compress_hyper_5_15_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (compress_hyper_5_15_chunk.device_id = 1)) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 Index Cond: (_hyper_1_2_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) @@ -1180,10 +1185,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3572 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7148 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 28 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 52 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1214,9 +1219,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1242,8 +1247,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Heap Fetches: 0 -> Sort (never executed) @@ -1259,16 +1264,16 @@ FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time" DESC, metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC, _hyper_1_3_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC, _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1285,25 +1290,25 @@ FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk."time" DESC Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) (17 rows) -- @@ -1318,28 +1323,28 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on public.metrics (actual rows=16795 loops=1) Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 Order: metrics."time", metrics.device_id Startup Exclusion: false Runtime Exclusion: false - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Sort (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Sort (actual rows=10080 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", _hyper_1_3_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (24 rows) @@ -1356,21 +1361,21 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 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 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1397,10 +1402,10 @@ LIMIT 100; Output: _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."time" Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _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."time" Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1430,10 +1435,10 @@ LIMIT 100; Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1456,21 +1461,21 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1490,21 +1495,21 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1522,23 +1527,28 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 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 + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 + Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Sort (actual rows=10080 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.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 DESC, _hyper_1_3_chunk."time", _hyper_1_3_chunk.v3 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(16 rows) +(21 rows) -- should produce ordered path -- ASC/DESC for segmentby columns can be pushed down @@ -1553,25 +1563,25 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=10 loops=1) + -> Sort (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, compress_hyper_5_16_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (21 rows) @@ -1588,23 +1598,28 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 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 + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 + Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Sort (actual rows=10080 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.device_id DESC, _hyper_1_3_chunk.device_id_peer DESC, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(16 rows) +(21 rows) -- -- test constraint exclusion @@ -1619,20 +1634,20 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=16795 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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=3355 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=6715 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Sort (actual rows=5040 loops=1) + Rows Removed by Filter: 3365 + -> Sort (actual rows=10080 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=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (15 rows) @@ -1646,20 +1661,20 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=16795 loops=1) Order: metrics."time", metrics.device_id Chunks excluded during startup: 1 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3355 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=6715 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=10080 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=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) (15 rows) @@ -1667,19 +1682,20 @@ ORDER BY time, :PREFIX SELECT count(*) FROM :TEST_TABLE; - 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=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(10 rows) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) +(11 rows) -- test aggregate with GROUP BY -- Disable hash aggregation to get a deterministic test output @@ -1699,18 +1715,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 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=10 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=10080 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 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=15 loops=1) (20 rows) -- test window functions with GROUP BY @@ -1730,18 +1746,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 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=10 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=10080 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 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=15 loops=1) (21 rows) SET enable_hashagg = ON; @@ -1754,25 +1770,25 @@ SET enable_hashagg = ON; SELECT * FROM q ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=13680 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=27360 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=13680 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=13680 loops=1) + -> Subquery Scan on q (actual rows=27360 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=27360 loops=1) Order: metrics."time" - -> Sort (actual rows=3600 loops=1) + -> Sort (actual rows=7200 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Sort (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Sort (actual rows=10080 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) (17 rows) -- test CTE join @@ -1796,47 +1812,47 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=2736 loops=1) + Merge Join (actual rows=5472 loops=1) Merge Cond: (metrics."time" = metrics_1."time") - -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) Order: metrics."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 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) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Materialize (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=2736 loops=1) + Rows Removed by Filter: 12 + -> Materialize (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=5472 loops=1) Order: metrics_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) 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=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=2016 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 loops=1) 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=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (41 rows) -- test prepared statement @@ -1850,55 +1866,55 @@ WHERE device_id = 1; 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=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Partial Aggregate (actual rows=1 loops=1) - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (16 rows) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) DEALLOCATE prep; @@ -1916,30 +1932,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1953,30 +1969,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 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=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 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 = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1990,30 +2006,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Output: ((test_table_1.*)::metrics), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=1440 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=2016 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Sort (actual rows=2016 loops=1) Output: ((test_table_3.*)::metrics), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=2016 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2026,21 +2042,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> 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=2 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=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (17 rows) @@ -2056,21 +2072,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) Bulk Decompression: false - -> 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=2 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=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (22 rows) @@ -2083,20 +2099,20 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=13680 loops=1) + Merge Append (actual rows=27360 loops=1) Sort Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> 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=10 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=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (15 rows) @@ -2124,7 +2140,7 @@ ORDER BY device_id_peer, -> 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: 5040 + Rows Removed by Filter: 10080 -> 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 @@ -2150,7 +2166,7 @@ ORDER BY device_id_peer; -> 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) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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 @@ -2176,18 +2192,18 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Rows Removed by Filter: 10 -> 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) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 10 + Rows Removed by Filter: 15 (19 rows) --with multiple values can get a nested loop. @@ -2202,21 +2218,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 27360 - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) + Rows Removed by Join Filter: 54720 + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 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=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 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=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=13680) + -> Materialize (actual rows=2 loops=27360) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2230,25 +2246,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. @@ -2260,34 +2276,28 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10944 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=2736 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) + Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(27 rows) + -> Hash (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Buckets: 1024 Batches: 1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) SET seq_page_cost = 100; -- loop/row counts of this query is different on windows so we run it without analyze @@ -2327,25 +2337,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 8064 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=3 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (19 rows) :PREFIX_VERBOSE @@ -2356,34 +2366,28 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10944 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=2736 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) + Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(27 rows) + -> Hash (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Buckets: 1024 Batches: 1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) -- test view CREATE OR REPLACE VIEW compressed_view AS @@ -2406,10 +2410,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2429,18 +2433,17 @@ 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) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2448,22 +2451,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=3600 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: 1295 + -> 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=2 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: 2016 + -> 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=3 loops=9) + Index Cond: (device_id = m1.device_id) +(30 rows) :PREFIX SELECT * @@ -2486,8 +2488,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2498,16 +2500,16 @@ FROM :TEST_TABLE m1 -> 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: 647 - -> 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) + Rows Removed by Filter: 1295 + -> 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=2 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: 1008 - -> 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=2 loops=9) + Rows Removed by Filter: 2016 + -> 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=3 loops=9) Index Cond: (device_id = m1.device_id) -> Materialize (actual rows=10 loops=1) -> Merge Append (actual rows=3 loops=1) @@ -2515,20 +2517,20 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=2 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> 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 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=3 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 8 + Rows Removed by Filter: 12 (52 rows) :PREFIX @@ -2552,10 +2554,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2569,10 +2571,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> 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) @@ -2603,10 +2605,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2620,10 +2622,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -2642,8 +2644,8 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") @@ -2654,8 +2656,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2669,8 +2671,8 @@ LIMIT 10; -> Sort (actual rows=11 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2705,8 +2707,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2720,10 +2722,10 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> 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) @@ -2760,8 +2762,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2780,21 +2782,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2830,8 +2832,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 20; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=20 loops=1) -> Incremental Sort (actual rows=20 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2844,8 +2846,8 @@ LIMIT 20; -> Sort (actual rows=5 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2859,8 +2861,8 @@ LIMIT 20; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2881,8 +2883,8 @@ ORDER BY m1.time, m1.device_id, m2.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Incremental Sort (actual rows=10 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2895,8 +2897,8 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2910,8 +2912,8 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2936,18 +2938,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 472 -> 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")) + Rows Removed by Filter: 0 -> Index Only 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") Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 531 -> 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")) -(18 rows) + Rows Removed by Filter: 0 +(20 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -2969,18 +2973,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 472 -> 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)) + Rows Removed by Filter: 0 -> 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: 480 + Rows Removed by Filter: 531 -> 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) + Rows Removed by Filter: 0 +(20 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -2992,20 +2998,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 472 -> 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 + Rows Removed by Filter: 2 -> 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) Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 531 -> 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: 2 + Rows Removed by Filter: 3 (21 rows) EXECUTE param_prep (1); @@ -3167,34 +3173,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=1008 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=3024 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=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) - -> Append (actual rows=0 loops=13680) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 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=2016 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=6048 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=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 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=2016 loops=1) + -> Append (actual rows=0 loops=27360) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=27360) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 720 - -> 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=13680) + Rows Removed by Filter: 1440 + -> 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=27360) 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=13680) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=27360) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=27360) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1008 - -> 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=13680) + Rows Removed by Filter: 2016 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=3 loops=27360) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -3229,10 +3235,10 @@ LIMIT 5; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (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 (never executed) @@ -3257,21 +3263,21 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) Order: metrics_space."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) (16 rows) @@ -3289,51 +3295,51 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- - Result (actual rows=5472 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) + Result (actual rows=10944 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10944 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=1440 loops=1) + -> Merge Append (actual rows=2880 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Merge Append (actual rows=4032 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1008 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (actual rows=2016 loops=1) + -> Merge Append (actual rows=4032 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 4 + Rows Removed by Filter: 6 (45 rows) -- test empty targetlist @@ -3342,21 +3348,21 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) (15 rows) -- test empty resultset @@ -3370,15 +3376,15 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) @@ -3388,11 +3394,11 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2 + Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) (29 rows) @@ -3403,22 +3409,22 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=13680 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + Result (actual rows=27360 loops=1) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) (16 rows) -- test constraints not present in targetlist @@ -3429,24 +3435,24 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) (19 rows) @@ -3458,24 +3464,24 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) (19 rows) @@ -3486,14 +3492,14 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) (9 rows) @@ -3523,10 +3529,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 720 - Batches Removed by Filter: 1 + Rows Removed by Filter: 1440 + Batches Removed by Filter: 2 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 -> Sort (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 @@ -3535,10 +3541,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2160 - Batches Removed by Filter: 3 + Rows Removed by Filter: 4320 + Batches Removed by Filter: 6 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 -> Sort (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 @@ -3547,10 +3553,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 720 - Batches Removed by Filter: 1 + Rows Removed by Filter: 1440 + Batches Removed by Filter: 2 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3561,7 +3567,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id @@ -3569,7 +3575,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id @@ -3577,7 +3583,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3587,10 +3593,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 - Batches Removed by Filter: 2 + Rows Removed by Filter: 2016 + Batches Removed by Filter: 3 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 -> Sort (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 @@ -3599,10 +3605,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3024 - Batches Removed by Filter: 6 + Rows Removed by Filter: 6048 + Batches Removed by Filter: 9 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> Sort (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 @@ -3611,7 +3617,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 (103 rows) -- device_id constraint should be pushed down @@ -3630,8 +3636,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3660,20 +3666,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3727,21 +3733,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3767,14 +3773,14 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -3800,16 +3806,16 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=5 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -3850,8 +3856,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3883,21 +3889,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3905,19 +3911,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3926,20 +3932,20 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 (68 rows) :PREFIX @@ -3959,20 +3965,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4022,8 +4028,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) Filter: (device_id = 3) @@ -4052,21 +4058,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1440 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2160 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 4320 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (never executed) @@ -4109,29 +4115,32 @@ LIMIT 10; Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 719 + Rows Removed by Filter: 999 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_17_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 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)) + Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2157 + Rows Removed by Filter: 2997 -> Sort (actual rows=3 loops=1) Sort Key: compress_hyper_6_18_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 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)) + Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 719 + Rows Removed by Filter: 999 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_19_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 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)) -(27 rows) + Rows Removed by Filter: 1 +(30 rows) :PREFIX SELECT * @@ -4150,28 +4159,31 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=12 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 714 + Rows Removed by Filter: 988 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=18 loops=1) + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=36 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2142 + Rows Removed by Filter: 2964 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=12 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 714 + Rows Removed by Filter: 988 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(29 rows) + Rows Removed by Filter: 1 +(32 rows) :PREFIX SELECT * @@ -4190,28 +4202,31 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=13 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 713 + Rows Removed by Filter: 987 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=21 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=39 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2139 + Rows Removed by Filter: 2961 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=13 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 713 + Rows Removed by Filter: 987 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(29 rows) + Rows Removed by Filter: 1 +(32 rows) :PREFIX SELECT * @@ -4230,26 +4245,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=714 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1428 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 6 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 12 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2142 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4284 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 18 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 36 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=714 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1428 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 6 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 12 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4302,26 +4317,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1427 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 13 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4281 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 21 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 39 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1427 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 13 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4374,26 +4389,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1427 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 13 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4281 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 21 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 39 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1427 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 13 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4451,7 +4466,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4459,7 +4474,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4467,7 +4482,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4494,7 +4509,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4502,7 +4517,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -4531,7 +4546,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4539,7 +4554,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4547,7 +4562,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4555,19 +4570,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4577,7 +4592,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 2 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4585,13 +4600,13 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 (73 rows) :PREFIX @@ -4611,23 +4626,23 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4682,22 +4697,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1440 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2160 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 4320 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1440 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4705,19 +4720,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4725,21 +4740,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 2016 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 3024 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 6048 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 (68 rows) --pushdown between two order by column (not pushed down) @@ -4762,22 +4777,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1440 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2160 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 4320 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 1440 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4785,19 +4800,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4805,21 +4820,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 2016 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 3024 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 6048 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 (68 rows) --pushdown of quals on order by and segment by cols anded together @@ -4844,12 +4859,12 @@ LIMIT 10; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1427 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 Vectorized Filter: (_hyper_2_4_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 + Rows Removed by Filter: 13 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: ((compress_hyper_6_17_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (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 (never executed) @@ -4884,28 +4899,28 @@ LIMIT 10; Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=9 loops=1) + -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Sort (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4281 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 21 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 39 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1427 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 13 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4959,21 +4974,21 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -5024,13 +5039,13 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5077,13 +5092,13 @@ LIMIT 10; -> Sort (actual rows=7 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC, _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC, _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5120,18 +5135,18 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk.device_id, _hyper_2_5_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk.device_id, _hyper_2_6_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) @@ -5141,13 +5156,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) Heap Fetches: 0 (36 rows) @@ -5164,66 +5179,66 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=16795 loops=1) Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 Order: metrics_space."time", metrics_space.device_id Startup Exclusion: false Runtime Exclusion: false - -> Merge Append (actual rows=3355 loops=1) + -> Merge Append (actual rows=6715 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Sort (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Sort (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Sort (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Sort (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Merge Append (actual rows=5040 loops=1) + Rows Removed by Filter: 673 + -> Merge Append (actual rows=10080 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 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 Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 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 Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (62 rows) @@ -5240,32 +5255,32 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 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=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1008 loops=1) + -> 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=2016 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (28 rows) @@ -5308,7 +5323,7 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) @@ -5360,7 +5375,7 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) @@ -5389,35 +5404,35 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 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=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1008 loops=1) + -> 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=2016 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5438,35 +5453,35 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 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=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1008 loops=1) + -> 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=2016 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5485,38 +5500,38 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 loops=1) + Sort (actual rows=16795 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time", _hyper_2_7_chunk.v3 Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Append (actual rows=16795 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 673 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5534,40 +5549,40 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=16795 loops=1) Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=671 loops=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=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=2 loops=1) + -> Sort (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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 - -> Sort (actual rows=6 loops=1) + -> Sort (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, compress_hyper_6_21_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=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=2016 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (36 rows) @@ -5584,38 +5599,38 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 loops=1) + Sort (actual rows=16795 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Append (actual rows=16795 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 673 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5633,48 +5648,48 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=16795 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=3355 loops=1) + -> Merge Append (actual rows=6715 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=671 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1343 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Sort (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Sort (actual rows=4029 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2013 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=4029 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Sort (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=671 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1343 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Merge Append (actual rows=5040 loops=1) + Rows Removed by Filter: 673 + -> Merge Append (actual rows=10080 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (43 rows) @@ -5688,7 +5703,7 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=16795 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id @@ -5699,7 +5714,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -5707,7 +5722,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -5715,44 +5730,44 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 1 - -> Merge Append (actual rows=3355 loops=1) + Rows Removed by Filter: 2 + -> Merge Append (actual rows=6715 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1343 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=2013 loops=1) + -> Sort (actual rows=4029 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=4029 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1343 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Merge Append (actual rows=5040 loops=1) + -> Merge Append (actual rows=10080 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) (66 rows) @@ -5765,28 +5780,28 @@ FROM :TEST_TABLE; Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) (25 rows) -- test aggregate with GROUP BY @@ -5807,48 +5822,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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_4_chunk (actual rows=1440 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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_5_chunk (actual rows=4320 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) (50 rows) -- test window functions with GROUP BY @@ -5868,48 +5883,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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_4_chunk (actual rows=1440 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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_5_chunk (actual rows=4320 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) (51 rows) SET enable_hashagg = ON; @@ -5924,47 +5939,47 @@ FROM q ORDER BY v1; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=13680 loops=1) + Sort (actual rows=27360 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=13680 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=13680 loops=1) + -> Subquery Scan on q (actual rows=27360 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=27360 loops=1) Order: metrics_space."time" - -> Merge Append (actual rows=3600 loops=1) + -> Merge Append (actual rows=7200 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Sort (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=4320 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Sort (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Merge Append (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Merge Append (actual rows=10080 loops=1) Sort Key: _hyper_2_7_chunk."time" - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1008 loops=1) - -> Merge Append (actual rows=5040 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Merge Append (actual rows=10080 loops=1) Sort Key: _hyper_2_10_chunk."time" - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Sort (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=2016 loops=1) (41 rows) -- test CTE join @@ -5988,43 +6003,43 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=2736 loops=1) + Merge Join (actual rows=5472 loops=1) Merge Cond: (metrics_space."time" = metrics_space_1."time") - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) Order: metrics_space."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - -> Materialize (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=2736 loops=1) + -> Materialize (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=5472 loops=1) Order: metrics_space_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=2016 loops=1) Index Cond: (device_id = 2) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 6 (37 rows) -- test prepared statement @@ -6038,52 +6053,52 @@ WHERE device_id = 1; 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_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) (13 rows) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) EXECUTE prep; count ------- - 2736 + 5472 (1 row) DEALLOCATE prep; @@ -6101,30 +6116,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (26 rows) @@ -6138,29 +6153,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 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 Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6174,29 +6189,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5472 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=1440 loops=1) Output: ((test_table_1.*)::metrics_space), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=1440 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_device_id_device_id_peer__ts_meta_idx 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=1008 loops=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=2016 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Output: ((test_table_3.*)::metrics_space), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=2016 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6209,21 +6224,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=1008 loops=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=2016 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> 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=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (17 rows) @@ -6239,21 +6254,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=1008 loops=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=2016 loops=1) Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Bulk Decompression: false - -> 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=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (22 rows) @@ -6266,43 +6281,43 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=13680 loops=1) + Merge Append (actual rows=27360 loops=1) Sort Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> 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=2 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=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> 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=6 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=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 0 (39 rows) @@ -6439,21 +6454,21 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id_peer = 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 Filter: (compress_hyper_6_18_chunk.device_id_peer = 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 6 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 Filter: (compress_hyper_6_19_chunk.device_id_peer = 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> 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) Output: _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk.device_id_peer = 1) @@ -6472,14 +6487,14 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id_peer = 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 3 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk.device_id_peer = 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 9 -> 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) Output: _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) @@ -6498,42 +6513,42 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Join Filter: (_hyper_2_4_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 27360 - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Rows Removed by Join Filter: 54720 + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk.device_id_peer - -> Materialize (actual rows=2 loops=13680) + -> Materialize (actual rows=2 loops=27360) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6547,20 +6562,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6574,42 +6589,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10944 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6674,20 +6689,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Append (actual rows=5472 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6700,42 +6715,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10944 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6765,8 +6780,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) Filter: (device_id = 1) -> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -6799,18 +6814,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -6843,18 +6858,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6903,18 +6918,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6949,18 +6964,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -6991,8 +7006,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=2 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) Filter: (device_id = 3) @@ -7021,8 +7036,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_2 (never executed) Filter: (device_id = 1) @@ -7037,10 +7052,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7071,10 +7086,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -7088,10 +7103,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7116,7 +7131,7 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 39 + Rows Removed by Join Filter: 38 -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Merge Append (actual rows=10 loops=1) @@ -7124,18 +7139,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -7160,7 +7175,7 @@ LIMIT 10; -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) - -> Materialize (actual rows=49 loops=1) + -> Materialize (actual rows=48 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" -> Merge Append (actual rows=11 loops=1) @@ -7168,18 +7183,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7227,18 +7242,18 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=61 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=21 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7266,21 +7281,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7332,8 +7347,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -7352,21 +7367,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 4 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7418,18 +7433,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7454,18 +7469,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7513,18 +7528,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7549,18 +7564,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7596,9 +7611,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 7 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 472 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) + Rows Removed by Filter: 0 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (never executed) Filter: ("time" = g."time") -> Seq Scan on compress_hyper_6_18_chunk (never executed) @@ -7618,9 +7634,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 531 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) + Rows Removed by Filter: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) Filter: ("time" = g."time") -> Seq Scan on compress_hyper_6_21_chunk (never executed) @@ -7628,7 +7645,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m1_9 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 -(39 rows) +(41 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -7650,18 +7667,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 472 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) + Rows Removed by Filter: 0 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 531 -> Seq Scan on compress_hyper_6_20_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) + Rows Removed by Filter: 0 +(20 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -7673,18 +7692,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 472 -> Seq Scan on compress_hyper_6_18_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: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 531 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -(18 rows) + Rows Removed by Filter: 0 +(20 rows) EXECUTE param_prep (1); time | time @@ -7845,34 +7866,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=1008 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=3024 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=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) - -> Append (actual rows=0 loops=13680) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) + -> Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 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=2016 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=6048 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=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 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=2016 loops=1) + -> Append (actual rows=0 loops=27360) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=27360) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 720 - -> 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=13680) + Rows Removed by Filter: 1440 + -> 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=27360) 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=13680) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=27360) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=27360) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1008 - -> 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=13680) + Rows Removed by Filter: 2016 + -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=3 loops=27360) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -7932,7 +7953,7 @@ $$; -> Sort (actual rows=6 loops=1) Sort Key: compress_hyper_12_31_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_12_31_chunk (actual rows=15 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_12_30_chunk._ts_meta_max_1 DESC @@ -7966,26 +7987,26 @@ $$; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) - -> Merge Append (actual rows=13680 loops=1) + -> Merge Append (actual rows=27360 loops=1) Sort Key: d_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=3600 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=5040 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=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=5040 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=10 loops=1) - -> Limit (actual rows=0 loops=13680) - -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=7200 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=10080 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=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=10080 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=15 loops=1) + -> Limit (actual rows=0 loops=27360) + -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=27360) Order: m."time" DESC Hypertables excluded during runtime: 0 - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=13680) - -> 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=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=27360) + -> 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=27360) 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=13680) - -> 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=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=27360) + -> 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=27360) 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=13680) - -> 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=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=27360) + -> 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=27360) Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) (23 rows) @@ -8056,10 +8077,10 @@ PREPARE tableoid_prep AS SELECT tableoid::regclass FROM :TEST_TABLE WHERE device -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -9586,19 +9607,19 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v (13 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; - QUERY PLAN -------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------ Gather Merge Workers Planned: 4 -> Sort - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk - -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk -> Parallel Seq Scan on compress_hyper_6_17_chunk -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk -> Parallel Seq Scan on compress_hyper_6_19_chunk + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk + -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk -> Parallel Seq Scan on compress_hyper_6_18_chunk -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk @@ -9676,27 +9697,27 @@ $sql$ $sql$; -- should have decompresschunk node :PREFIX SELECT * FROM ht_func(); - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------- + Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) (6 rows) \c -- plan should be identical to previous plan in fresh session :PREFIX SELECT * FROM ht_func(); - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------- + Append (actual rows=27360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) (6 rows) -- repro for core dump related to total_table_pages setting that get diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 46eeae860c9..720f9698e5d 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -33,7 +33,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 10m +\set INTERVAL 5m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, From f45fa6ea90d6e47e711fe91383b32cd1ec00739b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 13 May 2024 14:05:43 +0200 Subject: [PATCH 028/157] Revert "even bigger table?" This reverts commit f50947e0fb2a08750e1b75c539c24b846c69e26f. --- .../expected/transparent_decompression-15.out | 2693 ++++++++--------- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 1337 insertions(+), 1358 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 87037d03278..e27a57abca2 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -35,7 +35,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 5m +\set INTERVAL 10m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, device_id, @@ -234,13 +234,13 @@ LIMIT 5; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 = 1) @@ -263,25 +263,25 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) Order: metrics."time" - -> Sort (actual rows=1440 loops=1) + -> 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=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> 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=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + -> 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 = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (19 rows) -- test expressions @@ -298,45 +298,44 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------ - Result (actual rows=10944 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=10944 loops=1) + Result (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=2880 loops=1) + -> Sort (actual rows=1440 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=2880 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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: 6 - -> Sort (actual rows=4032 loops=1) + Rows Removed by Filter: 3 + -> Sort (actual rows=2016 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=4032 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6048 - -> Sort (actual rows=4032 loops=1) + Rows Removed by Filter: 3024 + -> Sort (actual rows=2016 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=4032 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=4 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 (23 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) -(7 rows) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) +(6 rows) -- test empty resultset :PREFIX @@ -349,31 +348,30 @@ WHERE device_id < 0; -> 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: 10 + Rows Removed by Filter: 5 -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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: 15 + Rows Removed by Filter: 10 (12 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- - Result (actual rows=27360 loops=1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) -(8 rows) + QUERY PLAN +------------------------------------------------------------------------------------------ + Result (actual rows=13680 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) +(7 rows) -- test constraints not present in targetlist :PREFIX @@ -383,28 +381,28 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + -> 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 = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (22 rows) -- test order not present in targetlist @@ -415,28 +413,28 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + -> 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 = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (22 rows) -- test column with all NULL @@ -446,18 +444,18 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 4032 + -> 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 = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (12 rows) -- @@ -484,10 +482,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 7200 - Batches Removed by Filter: 10 + Rows Removed by Filter: 3600 + Batches Removed by Filter: 5 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> Sort (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 @@ -496,7 +494,7 @@ ORDER BY time, -> Seq Scan 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.v3 > '10'::double precision) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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", _hyper_1_3_chunk.device_id @@ -504,10 +502,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_3_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 10080 - Batches Removed by Filter: 15 + Rows Removed by Filter: 5040 + Batches Removed by Filter: 10 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (37 rows) @@ -527,10 +525,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -556,8 +554,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -588,20 +586,20 @@ LIMIT 10; -> 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 IS NULL) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 (23 rows) -- test IN (Const,Const) @@ -620,10 +618,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2880 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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: 6 + Rows Removed by Filter: 3 -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -651,10 +649,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -683,20 +681,20 @@ LIMIT 10; -> 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 = device_id_peer) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 (23 rows) :PREFIX @@ -714,8 +712,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -744,10 +742,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 3) -> Sort (never executed) @@ -775,10 +773,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 5760 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 2880 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) -> Sort (never executed) @@ -804,14 +802,13 @@ LIMIT 10; 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: 4995 + Rows Removed by Filter: 3595 -> 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)) - Rows Removed by Filter: 5 -(10 rows) +(9 rows) :PREFIX SELECT * @@ -826,13 +823,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=60 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=30 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4940 + Rows Removed by Filter: 3570 -> 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) - Rows Removed by Filter: 5 -(10 rows) +(9 rows) :PREFIX SELECT * @@ -847,13 +843,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=65 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=35 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4935 + Rows Removed by Filter: 3565 -> 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) - Rows Removed by Filter: 5 -(10 rows) +(9 rows) :PREFIX SELECT * @@ -870,10 +865,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7140 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3570 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 60 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 30 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -902,10 +897,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7135 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 65 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 35 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -934,10 +929,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7135 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 65 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 35 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -971,13 +966,13 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (v0 < 1) - Rows Removed by Filter: 8064 + Rows Removed by Filter: 4032 -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) @@ -1005,11 +1000,11 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) Filter: (v0 < device_id) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1034,9 +1029,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1069,13 +1064,13 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=0 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=0 loops=1) Filter: (v1 = device_id) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1083,7 +1078,7 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 (25 rows) --pushdown between two order by column (not pushed down) @@ -1104,21 +1099,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 7200 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 3600 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 10080 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 5040 + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (23 rows) --pushdown of quals on order by and segment by cols anded together @@ -1143,15 +1138,15 @@ LIMIT 10; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=713 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 Vectorized Filter: (_hyper_1_1_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 13 + Rows Removed by Filter: 7 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: ((compress_hyper_5_15_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (compress_hyper_5_15_chunk.device_id = 1)) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 Index Cond: (_hyper_1_2_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) @@ -1185,10 +1180,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7148 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3572 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 52 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 28 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1219,9 +1214,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1247,8 +1242,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Heap Fetches: 0 -> Sort (never executed) @@ -1264,16 +1259,16 @@ FROM :TEST_TABLE ORDER BY time DESC, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time" DESC, metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC, _hyper_1_3_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC, _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1290,25 +1285,25 @@ FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk."time" DESC Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (17 rows) -- @@ -1323,28 +1318,28 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=16795 loops=1) + Custom Scan (ChunkAppend) on public.metrics (actual rows=8395 loops=1) Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 Order: metrics."time", metrics.device_id Startup Exclusion: false Runtime Exclusion: false - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=5040 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", _hyper_1_3_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (24 rows) @@ -1361,21 +1356,21 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1402,10 +1397,10 @@ LIMIT 100; Output: _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."time" Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _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."time" Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 + Rows Removed by Filter: 1685 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1435,10 +1430,10 @@ LIMIT 100; Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 + Rows Removed by Filter: 1685 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1461,21 +1456,21 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1495,21 +1490,21 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1527,28 +1522,23 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Sort (actual rows=8395 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - -> Sort (actual rows=6715 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 - Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + Sort Method: quicksort + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=10080 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.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 DESC, _hyper_1_3_chunk."time", _hyper_1_3_chunk.v3 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- should produce ordered path -- ASC/DESC for segmentby columns can be pushed down @@ -1563,25 +1553,25 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=15 loops=1) + -> Sort (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, compress_hyper_5_16_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (21 rows) @@ -1598,28 +1588,23 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Sort (actual rows=8395 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - -> Sort (actual rows=6715 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 - Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + Sort Method: quicksort + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=10080 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.device_id DESC, _hyper_1_3_chunk.device_id_peer DESC, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- -- test constraint exclusion @@ -1634,20 +1619,20 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=16795 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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=6715 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3355 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=10080 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=5040 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=10080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (15 rows) @@ -1661,20 +1646,20 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=16795 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) Order: metrics."time", metrics.device_id Chunks excluded during startup: 1 - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=6715 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3355 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=10080 loops=1) + -> Sort (actual rows=5040 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=10080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) (15 rows) @@ -1682,20 +1667,19 @@ ORDER BY time, :PREFIX SELECT count(*) FROM :TEST_TABLE; - 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=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - Heap Fetches: 0 + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) -(11 rows) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) +(10 rows) -- test aggregate with GROUP BY -- Disable hash aggregation to get a deterministic test output @@ -1715,18 +1699,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=10080 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 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=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) (20 rows) -- test window functions with GROUP BY @@ -1746,18 +1730,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=10080 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 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=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) (21 rows) SET enable_hashagg = ON; @@ -1770,25 +1754,25 @@ SET enable_hashagg = ON; SELECT * FROM q ORDER BY v1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=27360 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ + Sort (actual rows=13680 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=27360 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=27360 loops=1) + -> Subquery Scan on q (actual rows=13680 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=13680 loops=1) Order: metrics."time" - -> Sort (actual rows=7200 loops=1) + -> Sort (actual rows=3600 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - -> Sort (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (17 rows) -- test CTE join @@ -1812,47 +1796,47 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=5472 loops=1) + Merge Join (actual rows=2736 loops=1) Merge Cond: (metrics."time" = metrics_1."time") - -> Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) Order: metrics."time" - -> Sort (actual rows=1440 loops=1) + -> 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=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> 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=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + -> 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 = 1) - Rows Removed by Filter: 12 - -> Materialize (actual rows=5472 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=5472 loops=1) + Rows Removed by Filter: 8 + -> Materialize (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=2736 loops=1) Order: metrics_1."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) 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=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=720 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: 8 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=1008 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) 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=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (41 rows) -- test prepared statement @@ -1866,55 +1850,55 @@ WHERE device_id = 1; 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=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 + Rows Removed by Filter: 4032 -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + -> 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 = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (16 rows) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) DEALLOCATE prep; @@ -1932,30 +1916,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1969,30 +1953,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 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=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 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 = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 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=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2006,30 +1990,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Output: ((test_table_1.*)::metrics), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=1008 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1008 loops=1) Output: ((test_table_3.*)::metrics), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2042,21 +2026,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (17 rows) @@ -2072,21 +2056,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 + Rows Removed by Filter: 4032 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (22 rows) @@ -2099,20 +2083,20 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=27360 loops=1) + Merge Append (actual rows=13680 loops=1) Sort Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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=10 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=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false - -> 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=15 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (15 rows) @@ -2140,7 +2124,7 @@ ORDER BY device_id_peer, -> 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: 10080 + Rows Removed by Filter: 5040 -> 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 @@ -2166,7 +2150,7 @@ ORDER BY device_id_peer; -> 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) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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 @@ -2192,18 +2176,18 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> 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) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 (19 rows) --with multiple values can get a nested loop. @@ -2218,21 +2202,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 54720 - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) + Rows Removed by Join Filter: 27360 + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 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=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=27360) + -> Materialize (actual rows=2 loops=13680) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2246,25 +2230,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 8 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. @@ -2276,28 +2260,34 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10944 loops=1) + Nested Loop (actual rows=5472 loops=1) Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) + -> Unique (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Sort (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + Sort Method: quicksort + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Append (actual rows=2736 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 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=2) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 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=2 loops=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Hash (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Buckets: 1024 Batches: 1 - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 -(21 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(27 rows) SET seq_page_cost = 100; -- loop/row counts of this query is different on windows so we run it without analyze @@ -2337,25 +2327,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1440 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 8 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 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=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (19 rows) :PREFIX_VERBOSE @@ -2366,28 +2356,34 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10944 loops=1) + Nested Loop (actual rows=5472 loops=1) Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=7200 loops=1) + -> Unique (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Sort (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + Sort Method: quicksort + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Append (actual rows=2736 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 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=2) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=10080 loops=1) + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) + Rows Removed by Filter: 4032 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=15 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=2 loops=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Hash (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Buckets: 1024 Batches: 1 - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 -(21 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(27 rows) -- test view CREATE OR REPLACE VIEW compressed_view AS @@ -2410,10 +2406,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=3 loops=1) + -> 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 = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2433,17 +2429,18 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) - -> Nested Loop (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)) -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2451,21 +2448,22 @@ 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: 1295 - -> 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=2 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: 2016 - -> 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=3 loops=9) - Index Cond: (device_id = m1.device_id) -(30 rows) + -> 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=3600 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) :PREFIX SELECT * @@ -2488,8 +2486,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2500,16 +2498,16 @@ FROM :TEST_TABLE m1 -> 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: 1295 - -> 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=2 loops=10) + Rows Removed by Filter: 647 + -> 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: 2016 - -> 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=3 loops=9) + Rows Removed by Filter: 1008 + -> 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=2 loops=9) Index Cond: (device_id = m1.device_id) -> Materialize (actual rows=10 loops=1) -> Merge Append (actual rows=3 loops=1) @@ -2517,20 +2515,20 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 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: 8 + 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 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=2 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 (52 rows) :PREFIX @@ -2554,10 +2552,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2571,10 +2569,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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: 8 + Rows Removed by Filter: 4 -> 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) @@ -2605,10 +2603,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2622,10 +2620,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -2644,8 +2642,8 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") @@ -2656,8 +2654,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2671,8 +2669,8 @@ LIMIT 10; -> Sort (actual rows=11 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2707,8 +2705,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2722,10 +2720,10 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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: 8 + Rows Removed by Filter: 4 -> 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) @@ -2762,8 +2760,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2782,21 +2780,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2832,8 +2830,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 20; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=20 loops=1) -> Incremental Sort (actual rows=20 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2846,8 +2844,8 @@ LIMIT 20; -> Sort (actual rows=5 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2861,8 +2859,8 @@ LIMIT 20; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2883,8 +2881,8 @@ ORDER BY m1.time, m1.device_id, m2.device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Incremental Sort (actual rows=10 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2897,8 +2895,8 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2912,8 +2910,8 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2938,20 +2936,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 472 + Rows Removed by Filter: 336 -> 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")) - Rows Removed by Filter: 0 -> Index Only 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") Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 531 + Rows Removed by Filter: 480 -> 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")) - Rows Removed by Filter: 0 -(20 rows) +(18 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -2973,20 +2969,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 472 + Rows Removed by Filter: 336 -> 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)) - Rows Removed by Filter: 0 -> 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: 531 + Rows Removed by Filter: 480 -> 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)) - Rows Removed by Filter: 0 -(20 rows) +(18 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -2998,20 +2992,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 472 + Rows Removed by Filter: 336 -> 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: 2 + Rows Removed by Filter: 1 -> 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) Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 531 + Rows Removed by Filter: 480 -> 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: 3 + Rows Removed by Filter: 2 (21 rows) EXECUTE param_prep (1); @@ -3173,34 +3167,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 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=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 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=2016 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=6048 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=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 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=2016 loops=1) - -> Append (actual rows=0 loops=27360) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=27360) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=1008 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=3024 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) + -> Append (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1440 - -> 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=27360) + Rows Removed by Filter: 720 + -> 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=13680) 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=27360) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=13680) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=27360) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 2016 - -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=3 loops=27360) + Rows Removed by Filter: 1008 + -> 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=13680) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -3235,10 +3229,10 @@ LIMIT 5; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (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 (never executed) @@ -3263,21 +3257,21 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) Order: metrics_space."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (16 rows) @@ -3295,51 +3289,51 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- - Result (actual rows=10944 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10944 loops=1) + Result (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=2880 loops=1) + -> Merge Append (actual rows=1440 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 4 - -> Merge Append (actual rows=4032 loops=1) + Rows Removed by Filter: 2 + -> Merge Append (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1008 loops=1) Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (actual rows=4032 loops=1) + -> Merge Append (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 (45 rows) -- test empty targetlist @@ -3348,21 +3342,21 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (15 rows) -- test empty resultset @@ -3376,15 +3370,15 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) @@ -3394,11 +3388,11 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) (29 rows) @@ -3409,22 +3403,22 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=27360 loops=1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + Result (actual rows=13680 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (16 rows) -- test constraints not present in targetlist @@ -3435,24 +3429,24 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (19 rows) @@ -3464,24 +3458,24 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (19 rows) @@ -3492,14 +3486,14 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (9 rows) @@ -3529,10 +3523,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1440 - Batches Removed by Filter: 2 + Rows Removed by Filter: 720 + Batches Removed by Filter: 1 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 -> Sort (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 @@ -3541,10 +3535,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 4320 - Batches Removed by Filter: 6 + Rows Removed by Filter: 2160 + Batches Removed by Filter: 3 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 -> Sort (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 @@ -3553,10 +3547,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1440 - Batches Removed by Filter: 2 + Rows Removed by Filter: 720 + Batches Removed by Filter: 1 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3567,7 +3561,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id @@ -3575,7 +3569,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id @@ -3583,7 +3577,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3593,10 +3587,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 - Batches Removed by Filter: 3 + Rows Removed by Filter: 1008 + Batches Removed by Filter: 2 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 -> Sort (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 @@ -3605,10 +3599,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 6048 - Batches Removed by Filter: 9 + Rows Removed by Filter: 3024 + Batches Removed by Filter: 6 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> Sort (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 @@ -3617,7 +3611,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 (103 rows) -- device_id constraint should be pushed down @@ -3636,8 +3630,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3666,20 +3660,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3733,21 +3727,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3773,14 +3767,14 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -3806,16 +3800,16 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=5 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -3856,8 +3850,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3889,21 +3883,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3911,19 +3905,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3932,20 +3926,20 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 (68 rows) :PREFIX @@ -3965,20 +3959,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4028,8 +4022,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) Filter: (device_id = 3) @@ -4058,21 +4052,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 1440 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 4320 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 2160 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (never executed) @@ -4115,32 +4109,29 @@ LIMIT 10; Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 999 + Rows Removed by Filter: 719 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_17_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 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)) - Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2997 + Rows Removed by Filter: 2157 -> Sort (actual rows=3 loops=1) Sort Key: compress_hyper_6_18_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 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)) - Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 999 + Rows Removed by Filter: 719 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_19_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 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)) - Rows Removed by Filter: 1 -(30 rows) +(27 rows) :PREFIX SELECT * @@ -4159,31 +4150,28 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=12 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=6 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 988 + Rows Removed by Filter: 714 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=36 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=18 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2964 + Rows Removed by Filter: 2142 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=12 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=6 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 988 + Rows Removed by Filter: 714 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -(32 rows) +(29 rows) :PREFIX SELECT * @@ -4202,31 +4190,28 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=13 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=7 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 987 + Rows Removed by Filter: 713 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=39 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=21 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2961 + Rows Removed by Filter: 2139 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=13 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=7 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 987 + Rows Removed by Filter: 713 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -(32 rows) +(29 rows) :PREFIX SELECT * @@ -4245,26 +4230,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1428 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=714 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 12 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 6 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4284 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2142 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 36 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 18 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1428 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=714 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 12 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 6 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4317,26 +4302,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 13 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4281 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 39 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 21 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 13 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4389,26 +4374,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 13 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4281 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 39 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 21 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 13 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4466,7 +4451,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4474,7 +4459,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4482,7 +4467,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4509,7 +4494,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4517,7 +4502,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -4546,7 +4531,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4554,7 +4539,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4562,7 +4547,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4570,19 +4555,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4592,7 +4577,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4600,13 +4585,13 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 (73 rows) :PREFIX @@ -4626,23 +4611,23 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4697,22 +4682,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1440 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 4320 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 2160 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1440 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4720,19 +4705,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4740,21 +4725,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1008 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 6048 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 3024 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 (68 rows) --pushdown between two order by column (not pushed down) @@ -4777,22 +4762,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1440 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 4320 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 2160 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1440 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4800,19 +4785,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4820,21 +4805,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1008 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 6048 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 3024 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 (68 rows) --pushdown of quals on order by and segment by cols anded together @@ -4859,12 +4844,12 @@ LIMIT 10; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=713 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 Vectorized Filter: (_hyper_2_4_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 13 + Rows Removed by Filter: 7 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: ((compress_hyper_6_17_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (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 (never executed) @@ -4899,28 +4884,28 @@ LIMIT 10; Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=10 loops=1) + -> Sort (actual rows=9 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Sort (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4281 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 39 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 21 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1427 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 13 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4974,21 +4959,21 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -5039,13 +5024,13 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5092,13 +5077,13 @@ LIMIT 10; -> Sort (actual rows=7 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC, _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC, _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5135,18 +5120,18 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk.device_id, _hyper_2_5_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk.device_id, _hyper_2_6_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) @@ -5156,13 +5141,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) Heap Fetches: 0 (36 rows) @@ -5179,66 +5164,66 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=16795 loops=1) + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=8395 loops=1) Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 Order: metrics_space."time", metrics_space.device_id Startup Exclusion: false Runtime Exclusion: false - -> Merge Append (actual rows=6715 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Sort (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Sort (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Sort (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Sort (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Merge Append (actual rows=10080 loops=1) + Rows Removed by Filter: 337 + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 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 Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 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 Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (62 rows) @@ -5255,32 +5240,32 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=2016 loops=1) + -> 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=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (28 rows) @@ -5323,7 +5308,7 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) @@ -5375,7 +5360,7 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) @@ -5404,35 +5389,35 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=2016 loops=1) + -> 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=1008 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5453,35 +5438,35 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=2016 loops=1) + -> 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=1008 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5500,38 +5485,38 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=16795 loops=1) + Sort (actual rows=8395 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time", _hyper_2_7_chunk.v3 Sort Method: quicksort - -> Append (actual rows=16795 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 337 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5549,40 +5534,40 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=16795 loops=1) + Merge Append (actual rows=8395 loops=1) Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=1343 loops=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=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=3 loops=1) + -> Sort (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Sort (actual rows=9 loops=1) + -> Sort (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, compress_hyper_6_21_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=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=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (36 rows) @@ -5599,38 +5584,38 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=16795 loops=1) + Sort (actual rows=8395 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Sort Method: quicksort - -> Append (actual rows=16795 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Append (actual rows=8395 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 337 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5648,48 +5633,48 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=16795 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=6715 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1343 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=671 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Sort (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Sort (actual rows=2013 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=4029 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2013 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Sort (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1343 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=671 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Merge Append (actual rows=10080 loops=1) + Rows Removed by Filter: 337 + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (43 rows) @@ -5703,7 +5688,7 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=16795 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id @@ -5714,7 +5699,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -5722,7 +5707,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -5730,44 +5715,44 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 2 - -> Merge Append (actual rows=6715 loops=1) + Rows Removed by Filter: 1 + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=671 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=4029 loops=1) + -> Sort (actual rows=2013 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2013 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=671 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Merge Append (actual rows=10080 loops=1) + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) (66 rows) @@ -5780,28 +5765,28 @@ FROM :TEST_TABLE; Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (25 rows) -- test aggregate with GROUP BY @@ -5822,48 +5807,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (50 rows) -- test window functions with GROUP BY @@ -5883,48 +5868,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) (51 rows) SET enable_hashagg = ON; @@ -5939,47 +5924,47 @@ FROM q ORDER BY v1; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=27360 loops=1) + Sort (actual rows=13680 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=27360 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=27360 loops=1) + -> Subquery Scan on q (actual rows=13680 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=13680 loops=1) Order: metrics_space."time" - -> Merge Append (actual rows=7200 loops=1) + -> Merge Append (actual rows=3600 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2160 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Sort (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Merge Append (actual rows=10080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_7_chunk."time" - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=6048 loops=1) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=2016 loops=1) - -> Merge Append (actual rows=10080 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time" - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) - -> Sort (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=9 loops=1) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=1008 loops=1) (41 rows) -- test CTE join @@ -6003,43 +5988,43 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=5472 loops=1) + Merge Join (actual rows=2736 loops=1) Merge Cond: (metrics_space."time" = metrics_space_1."time") - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) Order: metrics_space."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Materialize (actual rows=5472 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=5472 loops=1) + -> Materialize (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=2736 loops=1) Order: metrics_space_1."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 2 + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1008 loops=1) Index Cond: (device_id = 2) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 (37 rows) -- test prepared statement @@ -6053,52 +6038,52 @@ WHERE device_id = 1; 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_2_4_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) (13 rows) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) EXECUTE prep; count ------- - 5472 + 2736 (1 row) DEALLOCATE prep; @@ -6116,30 +6101,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (26 rows) @@ -6153,29 +6138,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 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 Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6189,29 +6174,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5472 loops=1) + Merge Append (actual rows=2736 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=720 loops=1) Output: ((test_table_1.*)::metrics_space), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=2016 loops=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=1008 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Output: ((test_table_3.*)::metrics_space), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=1008 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6224,21 +6209,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=2016 loops=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=1008 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (17 rows) @@ -6254,21 +6239,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=2016 loops=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=1008 loops=1) Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (22 rows) @@ -6281,43 +6266,43 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=27360 loops=1) + Merge Append (actual rows=13680 loops=1) Sort Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> 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=6 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=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> 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=2 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=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false - -> 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=9 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=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 0 (39 rows) @@ -6454,21 +6439,21 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id_peer = 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 Filter: (compress_hyper_6_18_chunk.device_id_peer = 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 Filter: (compress_hyper_6_19_chunk.device_id_peer = 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 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) Output: _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk.device_id_peer = 1) @@ -6487,14 +6472,14 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id_peer = 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk.device_id_peer = 1) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> 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) Output: _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) @@ -6513,42 +6498,42 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Join Filter: (_hyper_2_4_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 54720 - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + Rows Removed by Join Filter: 27360 + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer - -> Materialize (actual rows=2 loops=27360) + -> Materialize (actual rows=2 loops=13680) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6562,20 +6547,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6589,42 +6574,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10944 loops=1) + Hash Semi Join (actual rows=5472 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6689,20 +6674,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5472 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + Append (actual rows=2736 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6715,42 +6700,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10944 loops=1) + Hash Semi Join (actual rows=5472 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1440 loops=1) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=4320 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1440 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=6048 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6780,8 +6765,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -6814,18 +6799,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -6858,18 +6843,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6918,18 +6903,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6964,18 +6949,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -7006,8 +6991,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) Filter: (device_id = 3) @@ -7036,8 +7021,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_2 (never executed) Filter: (device_id = 1) @@ -7052,10 +7037,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7086,10 +7071,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -7103,10 +7088,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7131,7 +7116,7 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 38 + Rows Removed by Join Filter: 39 -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Merge Append (actual rows=10 loops=1) @@ -7139,18 +7124,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -7175,7 +7160,7 @@ LIMIT 10; -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) - -> Materialize (actual rows=48 loops=1) + -> Materialize (actual rows=49 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" -> Merge Append (actual rows=11 loops=1) @@ -7183,18 +7168,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7242,18 +7227,18 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=61 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=21 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7281,21 +7266,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7347,8 +7332,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -7367,21 +7352,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7433,18 +7418,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7469,18 +7454,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7528,18 +7513,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7564,18 +7549,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=4320 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7611,10 +7596,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 7 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 472 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) - Rows Removed by Filter: 0 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (never executed) Filter: ("time" = g."time") -> Seq Scan on compress_hyper_6_18_chunk (never executed) @@ -7634,10 +7618,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 531 + Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) - Rows Removed by Filter: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) Filter: ("time" = g."time") -> Seq Scan on compress_hyper_6_21_chunk (never executed) @@ -7645,7 +7628,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m1_9 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 -(41 rows) +(39 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -7667,20 +7650,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 472 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) - Rows Removed by Filter: 0 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 531 + Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) - Rows Removed by Filter: 0 -(20 rows) +(18 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -7692,20 +7673,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 472 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_18_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: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 531 + Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_21_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: 0 -(20 rows) +(18 rows) EXECUTE param_prep (1); time | time @@ -7866,34 +7845,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1440 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=4320 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=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1440 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=2 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=2016 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=6048 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=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=2016 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=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=6048 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=9 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=2016 loops=1) - -> Append (actual rows=0 loops=27360) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=27360) + -> Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=1008 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=3024 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) + -> Append (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1440 - -> 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=27360) + Rows Removed by Filter: 720 + -> 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=13680) 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=27360) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=13680) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=27360) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 2016 - -> Index Scan using compress_hyper_5_16_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=3 loops=27360) + Rows Removed by Filter: 1008 + -> 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=13680) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -7953,7 +7932,7 @@ $$; -> Sort (actual rows=6 loops=1) Sort Key: compress_hyper_12_31_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=15 loops=1) + -> Seq Scan on compress_hyper_12_31_chunk (actual rows=10 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_12_30_chunk._ts_meta_max_1 DESC @@ -7987,26 +7966,26 @@ $$; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) - -> Merge Append (actual rows=27360 loops=1) + -> Merge Append (actual rows=13680 loops=1) Sort Key: d_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=7200 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=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=10080 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=15 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=10080 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=15 loops=1) - -> Limit (actual rows=0 loops=27360) - -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=27360) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=3600 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=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=5040 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=10 loops=1) + -> Limit (actual rows=0 loops=13680) + -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=13680) Order: m."time" DESC Hypertables excluded during runtime: 0 - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=27360) - -> 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=27360) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=13680) + -> 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=13680) 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=27360) - -> 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=27360) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=13680) + -> 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=13680) 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=27360) - -> 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=27360) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=13680) + -> 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=13680) Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) (23 rows) @@ -8077,10 +8056,10 @@ PREPARE tableoid_prep AS SELECT tableoid::regclass FROM :TEST_TABLE WHERE device -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -9607,19 +9586,19 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v (13 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------- Gather Merge Workers Planned: 4 -> Sort - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Parallel Append + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk + -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk -> Parallel Seq Scan on compress_hyper_6_17_chunk -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk -> Parallel Seq Scan on compress_hyper_6_19_chunk - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk - -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk -> Parallel Seq Scan on compress_hyper_6_18_chunk -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk @@ -9697,27 +9676,27 @@ $sql$ $sql$; -- should have decompresschunk node :PREFIX SELECT * FROM ht_func(); - QUERY PLAN -------------------------------------------------------------------------------------- - Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) \c -- plan should be identical to previous plan in fresh session :PREFIX SELECT * FROM ht_func(); - QUERY PLAN -------------------------------------------------------------------------------------- - Append (actual rows=27360 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=7200 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=10080 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=15 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=13680 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) -- repro for core dump related to total_table_pages setting that get diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 720f9698e5d..46eeae860c9 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -33,7 +33,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 5m +\set INTERVAL 10m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, From c5e89c610c896bd1965205bfe92f463d6f0717ff Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 14 May 2024 12:28:00 +0200 Subject: [PATCH 029/157] debug --- src/nodes/chunk_append/planner.c | 1 + .../expected/transparent_decompression-15.out | 95 +++++++++++++------ tsl/test/sql/transparent_decompression.sql.in | 22 ++--- 3 files changed, 75 insertions(+), 43 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index aea4aed7c9b..7df660e66b2 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -89,6 +89,7 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List &nullsFirst); /* inject sort node if child sort order does not match desired order */ +// if (!pathkeys_contained_in(pathkeys, path->pathkeys)) if (!pathkeys_contained_in(pathkeys, path->pathkeys) && !IsA(plan, Sort)) { plan = (Plan *) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index e27a57abca2..bd5f9e6ed31 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -134,51 +134,32 @@ VACUUM ANALYZE metrics_space; \set ECHO none -- compress first and last chunk on the hypertable ALTER TABLE metrics SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); -SELECT compress_chunk ('_timescaledb_internal._hyper_1_1_chunk'); +select compress_chunk(x) +from (select row_number() over (order by x) n, x from show_chunks('metrics') x) t +where n in (1, 3) +; compress_chunk ---------------------------------------- _timescaledb_internal._hyper_1_1_chunk -(1 row) - -SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); - compress_chunk ----------------------------------------- _timescaledb_internal._hyper_1_3_chunk -(1 row) +(2 rows) VACUUM ANALYZE metrics; -- compress some chunks on space partitioned hypertable -- we compress all chunks of first time slice, none of second, and 2 of the last time slice ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); -SELECT compress_chunk ('_timescaledb_internal._hyper_2_4_chunk'); - compress_chunk ----------------------------------------- +select compress_chunk(x) +from (select row_number() over (order by x) n, x from show_chunks('metrics_space') x) t +where n in (1, 2, 3, 7, 8) +; + compress_chunk +----------------------------------------- _timescaledb_internal._hyper_2_4_chunk -(1 row) - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_5_chunk'); - compress_chunk ----------------------------------------- _timescaledb_internal._hyper_2_5_chunk -(1 row) - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_6_chunk'); - compress_chunk ----------------------------------------- _timescaledb_internal._hyper_2_6_chunk -(1 row) - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_10_chunk'); - compress_chunk ------------------------------------------ _timescaledb_internal._hyper_2_10_chunk -(1 row) - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_11_chunk'); - compress_chunk ------------------------------------------ _timescaledb_internal._hyper_2_11_chunk -(1 row) +(5 rows) SELECT ht.schema_name || '.' || ht.table_name AS "METRICS_COMPRESSED" FROM _timescaledb_catalog.hypertable ht @@ -208,6 +189,58 @@ VACUUM ANALYZE metrics_space; -- we disable parallelism here otherwise EXPLAIN ANALYZE output -- will be not stable and differ depending on worker assignment SET max_parallel_workers_per_gather TO 0; +select name, setting, unit, source from pg_settings where source != 'default' order by name; + name | setting | unit | source +---------------------------------+-----------------------------------------+------+---------------------- + application_name | pg_regress/transparent_decompression-15 | | client + autovacuum | off | | configuration file + DateStyle | Postgres, MDY | | client + default_text_search_config | pg_catalog.english | | configuration file + dynamic_shared_memory_type | posix | | configuration file + enable_bitmapscan | on | | session + enable_hashagg | on | | session + enable_hashjoin | on | | session + enable_mergejoin | on | | session + enable_seqscan | on | | session + extra_float_digits | 0 | | configuration file + fsync | off | | command line + IntervalStyle | postgres_verbose | | client + lc_messages | C | | configuration file + lc_monetary | en_IE.UTF-8 | | configuration file + lc_numeric | en_IE.UTF-8 | | configuration file + lc_time | en_IE.UTF-8 | | configuration file + listen_addresses | localhost | | command line + log_autovacuum_min_duration | 0 | ms | configuration file + log_checkpoints | on | | configuration file + log_destination | jsonlog,stderr | | configuration file + log_error_verbosity | verbose | | configuration file + logging_collector | on | | configuration file + log_line_prefix | %m: %u [%p] %d | | configuration file + log_lock_waits | on | | configuration file + log_min_messages | info | | configuration file + log_statement | all | | configuration file + log_temp_files | 128 | kB | configuration file + log_timezone | Europe/Berlin | | configuration file + max_connections | 200 | | configuration file + max_parallel_workers_per_gather | 0 | | session + max_prepared_transactions | 2 | | configuration file + max_wal_size | 1024 | MB | configuration file + max_worker_processes | 24 | | configuration file + min_wal_size | 80 | MB | configuration file + port | 55432 | | environment variable + random_page_cost | 1 | | configuration file + shared_buffers | 16384 | 8kB | configuration file + timescaledb.last_tuned | 1971-02-03 04:05:06.789012 -0300 | | configuration file + timescaledb.last_tuned_version | 0.0.1 | | configuration file + timescaledb.license | timescale | | configuration file + timescaledb_telemetry.cloud | ci | | configuration file + timescaledb.telemetry_level | off | | configuration file + TimeZone | PST8PDT | | client + transaction_deferrable | off | | override + transaction_isolation | read committed | | override + transaction_read_only | off | | override +(47 rows) + -- get explain for queries on hypertable with compression \set TEST_TABLE 'metrics' \ir :TEST_QUERY_NAME diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 46eeae860c9..4bf6077a247 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -155,9 +155,10 @@ RESET client_min_messages; -- compress first and last chunk on the hypertable ALTER TABLE metrics SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); -SELECT compress_chunk ('_timescaledb_internal._hyper_1_1_chunk'); - -SELECT compress_chunk ('_timescaledb_internal._hyper_1_3_chunk'); +select compress_chunk(x) +from (select row_number() over (order by x) n, x from show_chunks('metrics') x) t +where n in (1, 3) +; VACUUM ANALYZE metrics; @@ -166,15 +167,10 @@ VACUUM ANALYZE metrics; ALTER TABLE metrics_space SET (timescaledb.compress, timescaledb.compress_orderby = 'v0, v1 desc, time', timescaledb.compress_segmentby = 'device_id,device_id_peer'); -SELECT compress_chunk ('_timescaledb_internal._hyper_2_4_chunk'); - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_5_chunk'); - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_6_chunk'); - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_10_chunk'); - -SELECT compress_chunk ('_timescaledb_internal._hyper_2_11_chunk'); +select compress_chunk(x) +from (select row_number() over (order by x) n, x from show_chunks('metrics_space') x) t +where n in (1, 2, 3, 7, 8) +; SELECT ht.schema_name || '.' || ht.table_name AS "METRICS_COMPRESSED" FROM _timescaledb_catalog.hypertable ht @@ -224,6 +220,8 @@ RESET client_min_messages; SET max_parallel_workers_per_gather TO 0; +select name, setting, unit, source from pg_settings where source != 'default' order by name; + -- get explain for queries on hypertable with compression \set TEST_TABLE 'metrics' \ir :TEST_QUERY_NAME From 51c734c210bb310f6e900869ad5abf50de0a3e5c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 16 May 2024 12:58:11 +0200 Subject: [PATCH 030/157] add some asymmetry --- .../expected/transparent_decompression-15.out | 2177 ++++++++--------- tsl/test/sql/transparent_decompression.sql.in | 10 +- 2 files changed, 1066 insertions(+), 1121 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index bd5f9e6ed31..d56300dacb3 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -44,7 +44,7 @@ SELECT time, 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', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', (interval :'INTERVAL') / 3) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics DROP COLUMN filler_2; @@ -56,7 +56,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', (interval :'INTERVAL') / 2) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics DROP COLUMN filler_3; @@ -100,7 +100,7 @@ SELECT time, 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', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', (interval :'INTERVAL') / 3) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space DROP COLUMN filler_2; @@ -112,7 +112,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', (interval :'INTERVAL') / 2) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space DROP COLUMN filler_3; @@ -189,58 +189,6 @@ VACUUM ANALYZE metrics_space; -- we disable parallelism here otherwise EXPLAIN ANALYZE output -- will be not stable and differ depending on worker assignment SET max_parallel_workers_per_gather TO 0; -select name, setting, unit, source from pg_settings where source != 'default' order by name; - name | setting | unit | source ----------------------------------+-----------------------------------------+------+---------------------- - application_name | pg_regress/transparent_decompression-15 | | client - autovacuum | off | | configuration file - DateStyle | Postgres, MDY | | client - default_text_search_config | pg_catalog.english | | configuration file - dynamic_shared_memory_type | posix | | configuration file - enable_bitmapscan | on | | session - enable_hashagg | on | | session - enable_hashjoin | on | | session - enable_mergejoin | on | | session - enable_seqscan | on | | session - extra_float_digits | 0 | | configuration file - fsync | off | | command line - IntervalStyle | postgres_verbose | | client - lc_messages | C | | configuration file - lc_monetary | en_IE.UTF-8 | | configuration file - lc_numeric | en_IE.UTF-8 | | configuration file - lc_time | en_IE.UTF-8 | | configuration file - listen_addresses | localhost | | command line - log_autovacuum_min_duration | 0 | ms | configuration file - log_checkpoints | on | | configuration file - log_destination | jsonlog,stderr | | configuration file - log_error_verbosity | verbose | | configuration file - logging_collector | on | | configuration file - log_line_prefix | %m: %u [%p] %d | | configuration file - log_lock_waits | on | | configuration file - log_min_messages | info | | configuration file - log_statement | all | | configuration file - log_temp_files | 128 | kB | configuration file - log_timezone | Europe/Berlin | | configuration file - max_connections | 200 | | configuration file - max_parallel_workers_per_gather | 0 | | session - max_prepared_transactions | 2 | | configuration file - max_wal_size | 1024 | MB | configuration file - max_worker_processes | 24 | | configuration file - min_wal_size | 80 | MB | configuration file - port | 55432 | | environment variable - random_page_cost | 1 | | configuration file - shared_buffers | 16384 | 8kB | configuration file - timescaledb.last_tuned | 1971-02-03 04:05:06.789012 -0300 | | configuration file - timescaledb.last_tuned_version | 0.0.1 | | configuration file - timescaledb.license | timescale | | configuration file - timescaledb_telemetry.cloud | ci | | configuration file - timescaledb.telemetry_level | off | | configuration file - TimeZone | PST8PDT | | client - transaction_deferrable | off | | override - transaction_isolation | read committed | | override - transaction_read_only | off | | override -(47 rows) - -- get explain for queries on hypertable with compression \set TEST_TABLE 'metrics' \ir :TEST_QUERY_NAME @@ -267,13 +215,13 @@ LIMIT 5; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 = 1) @@ -296,18 +244,18 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=5183 loops=1) Order: metrics."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 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) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort @@ -331,22 +279,22 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------ - Result (actual rows=5472 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=5472 loops=1) + Result (actual rows=10366 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=10366 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=1440 loops=1) + -> Sort (actual rows=4318 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=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4318 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=6 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 - -> Sort (actual rows=2016 loops=1) + Rows Removed by Filter: 9 + -> Sort (actual rows=4032 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=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=4032 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -360,15 +308,16 @@ ORDER BY time, :PREFIX SELECT FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------- + Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(6 rows) +(7 rows) -- test empty resultset :PREFIX @@ -381,10 +330,10 @@ WHERE device_id < 0; -> 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 + Rows Removed by Filter: 15 -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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) @@ -395,16 +344,17 @@ WHERE device_id < 0; :PREFIX SELECT 1 FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=13680 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- + Result (actual rows=25915 loops=1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(7 rows) +(8 rows) -- test constraints not present in targetlist :PREFIX @@ -414,21 +364,21 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_1_1_chunk.v1 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=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk.v1 Sort Method: quicksort @@ -446,21 +396,21 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_1_1_chunk.v1 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=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk.v1 Sort Method: quicksort @@ -477,14 +427,14 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> 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 = 1) @@ -515,10 +465,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3600 - Batches Removed by Filter: 5 + Rows Removed by Filter: 10795 + Batches Removed by Filter: 15 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> Sort (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 @@ -527,7 +477,7 @@ ORDER BY time, -> Seq Scan 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.v3 > '10'::double precision) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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", _hyper_1_3_chunk.device_id @@ -558,10 +508,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -579,16 +529,16 @@ WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -619,13 +569,13 @@ LIMIT 10; -> 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 IS NULL) - Rows Removed by Filter: 5 + Rows Removed by Filter: 15 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -651,10 +601,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4318 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=6 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -682,10 +632,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -714,13 +664,13 @@ LIMIT 10; -> 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 = device_id_peer) - Rows Removed by Filter: 5 + Rows Removed by Filter: 15 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -737,16 +687,16 @@ WHERE device_id_peer < device_id ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -775,10 +725,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 3) -> Sort (never executed) @@ -806,10 +756,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2880 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 8636 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) -> Sort (never executed) @@ -835,13 +785,14 @@ LIMIT 10; 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: 3595 + Rows Removed by Filter: 4995 -> 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) + Rows Removed by Filter: 10 +(10 rows) :PREFIX SELECT * @@ -856,12 +807,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=90 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3570 + Rows Removed by Filter: 4910 -> 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) -(9 rows) + Rows Removed by Filter: 10 +(10 rows) :PREFIX SELECT * @@ -876,12 +828,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=35 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=95 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3565 + Rows Removed by Filter: 4905 -> 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) -(9 rows) + Rows Removed by Filter: 10 +(10 rows) :PREFIX SELECT * @@ -898,10 +851,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3570 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10705 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 30 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 90 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -930,10 +883,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10700 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 35 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 95 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -962,10 +915,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10700 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 35 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 95 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -999,13 +952,13 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 5 + Rows Removed by Filter: 15 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (v0 < 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) @@ -1033,11 +986,11 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 5 + Rows Removed by Filter: 15 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) Filter: (v0 < device_id) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1054,17 +1007,17 @@ WHERE device_id < v0 ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1097,13 +1050,13 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 5 + Rows Removed by Filter: 15 -> Sort (actual rows=0 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=0 loops=1) Filter: (v1 = device_id) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1132,14 +1085,14 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 3600 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 10795 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1171,15 +1124,15 @@ LIMIT 10; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2140 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 Vectorized Filter: (_hyper_1_1_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 + Rows Removed by Filter: 19 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: ((compress_hyper_5_15_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (compress_hyper_5_15_chunk.device_id = 1)) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 Index Cond: (_hyper_1_2_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) @@ -1213,10 +1166,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3572 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10719 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 28 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Rows Removed by Filter: 76 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1238,8 +1191,8 @@ WHERE time < now() ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id @@ -1247,9 +1200,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1318,20 +1271,20 @@ FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk."time" DESC Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort @@ -1351,19 +1304,19 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on public.metrics (actual rows=11755 loops=1) Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 Order: metrics."time", metrics.device_id Startup Exclusion: false Runtime Exclusion: false - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Sort (actual rows=5040 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", _hyper_1_3_chunk.device_id @@ -1389,16 +1342,16 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1430,10 +1383,10 @@ LIMIT 100; Output: _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."time" Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _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."time" Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1463,10 +1416,10 @@ LIMIT 100; Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1489,16 +1442,16 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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) @@ -1523,16 +1476,16 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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) @@ -1555,15 +1508,20 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 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 + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 + Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 + -> Sort (actual rows=5040 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.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 DESC, _hyper_1_3_chunk."time", _hyper_1_3_chunk.v3 + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1571,7 +1529,7 @@ ORDER BY device_id, -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(16 rows) +(21 rows) -- should produce ordered path -- ASC/DESC for segmentby columns can be pushed down @@ -1586,16 +1544,16 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1621,15 +1579,20 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 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 + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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 + Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 + -> Sort (actual rows=5040 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.device_id DESC, _hyper_1_3_chunk.device_id_peer DESC, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" + Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1637,7 +1600,7 @@ ORDER BY device_id DESC, -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(16 rows) +(21 rows) -- -- test constraint exclusion @@ -1652,14 +1615,14 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=11755 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 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=3355 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=6715 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 3365 -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1679,13 +1642,13 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=11755 loops=1) Order: metrics."time", metrics.device_id Chunks excluded during startup: 1 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=6715 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3355 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=6715 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1700,19 +1663,20 @@ ORDER BY time, :PREFIX SELECT count(*) FROM :TEST_TABLE; - 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=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) + Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(10 rows) +(11 rows) -- test aggregate with GROUP BY -- Disable hash aggregation to get a deterministic test output @@ -1732,14 +1696,14 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 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=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=10080 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) @@ -1763,14 +1727,14 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 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=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=10080 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) @@ -1787,20 +1751,20 @@ SET enable_hashagg = ON; SELECT * FROM q ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=13680 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=25915 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=13680 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=13680 loops=1) + -> Subquery Scan on q (actual rows=25915 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=25915 loops=1) Order: metrics."time" - -> Sort (actual rows=3600 loops=1) + -> Sort (actual rows=10795 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort @@ -1829,20 +1793,20 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=2736 loops=1) + Merge Join (actual rows=5183 loops=1) Merge Cond: (metrics."time" = metrics_1."time") - -> Custom Scan (ChunkAppend) on metrics (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=5183 loops=1) Order: metrics."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 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) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort @@ -1850,19 +1814,19 @@ ORDER BY q1.time; -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 8 - -> Materialize (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=2736 loops=1) + -> Materialize (actual rows=5183 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=5183 loops=1) Order: metrics_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) 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=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=2016 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_1_3_chunk_1."time" Sort Method: quicksort @@ -1883,14 +1847,14 @@ WHERE device_id = 1; 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=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Partial Aggregate (actual rows=1 loops=1) -> 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) @@ -1901,37 +1865,37 @@ WHERE device_id = 1; EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) DEALLOCATE prep; @@ -1949,22 +1913,22 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 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_device_id_device_id_peer__ts_meta_idx 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=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Key: _hyper_1_3_chunk."time" @@ -1986,22 +1950,22 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 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=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 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_device_id_device_id_peer__ts_meta_idx 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=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 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 = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 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" @@ -2023,22 +1987,22 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Output: ((test_table_1.*)::metrics), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=2159 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_device_id_device_id_peer__ts_meta_idx 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=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=2016 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Sort (actual rows=1008 loops=1) Output: ((test_table_3.*)::metrics), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" @@ -2059,17 +2023,17 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false @@ -2089,16 +2053,16 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) Bulk Decompression: false - -> 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) + -> 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=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) @@ -2116,14 +2080,14 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=13680 loops=1) + Merge Append (actual rows=25915 loops=1) Sort Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=15 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) @@ -2157,7 +2121,7 @@ ORDER BY device_id_peer, -> 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: 5040 + Rows Removed by Filter: 10080 -> 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 @@ -2183,7 +2147,7 @@ ORDER BY device_id_peer; -> 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) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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 @@ -2209,11 +2173,11 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 5 + Rows Removed by Filter: 15 -> 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) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 10080 -> 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 @@ -2235,21 +2199,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 27360 - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) + Rows Removed by Join Filter: 51830 + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 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=5 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id_peer -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 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=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=13680) + -> Materialize (actual rows=2 loops=25915) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2263,18 +2227,18 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false @@ -2293,34 +2257,28 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10366 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=2736 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) + Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(27 rows) + -> Hash (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Buckets: 1024 Batches: 1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) SET seq_page_cost = 100; -- loop/row counts of this query is different on windows so we run it without analyze @@ -2360,18 +2318,18 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 12 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 8064 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) Output: _hyper_1_3_chunk.device_id_peer Bulk Decompression: false @@ -2389,34 +2347,28 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10366 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=2736 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) + Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(27 rows) + -> Hash (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Buckets: 1024 Batches: 1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) -- test view CREATE OR REPLACE VIEW compressed_view AS @@ -2462,18 +2414,17 @@ 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) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2481,22 +2432,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=3600 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: 1942 + -> 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=3 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: 1008 + -> 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=2 loops=9) + Index Cond: (device_id = m1.device_id) +(30 rows) :PREFIX SELECT * @@ -2519,8 +2469,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2531,8 +2481,8 @@ FROM :TEST_TABLE m1 -> 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: 647 - -> 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) + Rows Removed by Filter: 1942 + -> 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=3 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") @@ -2548,10 +2498,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=3 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> 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 @@ -2585,10 +2535,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2602,10 +2552,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> 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) @@ -2636,10 +2586,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2653,10 +2603,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -2675,8 +2625,8 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") @@ -2687,8 +2637,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2702,8 +2652,8 @@ LIMIT 10; -> Sort (actual rows=11 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=15 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2738,8 +2688,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2753,10 +2703,10 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> 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) @@ -2793,8 +2743,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2813,21 +2763,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2863,8 +2813,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 20; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=20 loops=1) -> Incremental Sort (actual rows=20 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2877,8 +2827,8 @@ LIMIT 20; -> Sort (actual rows=5 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2892,8 +2842,8 @@ LIMIT 20; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=15 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2914,8 +2864,8 @@ ORDER BY m1.time, m1.device_id, m2.device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Incremental Sort (actual rows=10 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2928,8 +2878,8 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2943,8 +2893,8 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=15 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2969,9 +2919,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 408 -> 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")) + Rows Removed by Filter: 1 -> Index Only 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") Heap Fetches: 0 @@ -2980,7 +2931,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 480 -> 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")) -(18 rows) +(19 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -3002,9 +2953,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 408 -> 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)) + Rows Removed by Filter: 1 -> 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) @@ -3013,7 +2965,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 480 -> 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) +(19 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -3025,10 +2977,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 408 -> 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 + Rows Removed by Filter: 4 -> 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) @@ -3200,34 +3152,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=1008 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=3024 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=1008 loops=1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 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=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 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=2016 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=6048 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=2016 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) - -> Append (actual rows=0 loops=13680) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) + -> Append (actual rows=0 loops=25915) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=25915) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 720 - -> 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=13680) + Rows Removed by Filter: 2159 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=3 loops=25915) 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=13680) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=25915) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=25915) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 1008 - -> 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=13680) + -> 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=25915) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -3262,10 +3214,10 @@ LIMIT 5; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (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 (never executed) @@ -3290,15 +3242,15 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=5183 loops=1) Order: metrics_space."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" @@ -3322,35 +3274,35 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- - Result (actual rows=5472 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5472 loops=1) + Result (actual rows=10366 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10366 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=1440 loops=1) + -> Merge Append (actual rows=4318 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (actual rows=2016 loops=1) + Rows Removed by Filter: 6 + -> Merge Append (actual rows=4032 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=1008 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Merge Append (actual rows=2016 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id @@ -3375,16 +3327,16 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) @@ -3403,15 +3355,15 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) @@ -3436,17 +3388,17 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=13680 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + Result (actual rows=25915 loops=1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) @@ -3462,18 +3414,18 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk.v1 @@ -3491,18 +3443,18 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk.v1 @@ -3519,11 +3471,11 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) @@ -3556,10 +3508,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 720 - Batches Removed by Filter: 1 + Rows Removed by Filter: 2159 + Batches Removed by Filter: 3 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 -> Sort (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 @@ -3568,10 +3520,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2160 - Batches Removed by Filter: 3 + Rows Removed by Filter: 6477 + Batches Removed by Filter: 9 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 -> Sort (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 @@ -3580,10 +3532,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 720 - Batches Removed by Filter: 1 + Rows Removed by Filter: 2159 + Batches Removed by Filter: 3 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3594,7 +3546,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id @@ -3602,7 +3554,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id @@ -3610,7 +3562,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3663,8 +3615,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3693,20 +3645,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3760,21 +3712,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3833,16 +3785,16 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=5 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -3883,8 +3835,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3916,21 +3868,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3938,19 +3890,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3992,20 +3944,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4055,8 +4007,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) Filter: (device_id = 3) @@ -4085,21 +4037,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 2159 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2160 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 6477 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (never executed) @@ -4142,29 +4094,32 @@ LIMIT 10; Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 719 + Rows Removed by Filter: 999 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_17_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 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)) + Rows Removed by Filter: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2157 + Rows Removed by Filter: 2997 -> Sort (actual rows=3 loops=1) Sort Key: compress_hyper_6_18_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 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)) + Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 719 + Rows Removed by Filter: 999 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_19_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 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)) -(27 rows) + Rows Removed by Filter: 2 +(30 rows) :PREFIX SELECT * @@ -4183,28 +4138,31 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=18 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 714 + Rows Removed by Filter: 982 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 2 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=18 loops=1) + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=54 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2142 + Rows Removed by Filter: 2946 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 6 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=18 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 714 + Rows Removed by Filter: 982 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(29 rows) + Rows Removed by Filter: 2 +(32 rows) :PREFIX SELECT * @@ -4223,28 +4181,31 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=19 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 713 + Rows Removed by Filter: 981 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 2 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=21 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=57 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2139 + Rows Removed by Filter: 2943 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + Rows Removed by Filter: 6 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=7 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=19 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 713 + Rows Removed by Filter: 981 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(29 rows) + Rows Removed by Filter: 2 +(32 rows) :PREFIX SELECT * @@ -4263,26 +4224,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=714 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2141 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 6 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 18 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2142 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6423 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 18 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 54 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=714 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2141 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 6 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 18 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4335,26 +4296,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2140 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 19 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6420 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 21 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 57 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2140 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 19 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4407,26 +4368,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2140 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 19 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6420 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 21 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 57 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2140 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 19 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4484,7 +4445,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4492,7 +4453,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4500,7 +4461,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4564,7 +4525,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4572,7 +4533,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4580,7 +4541,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4588,19 +4549,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4644,23 +4605,23 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4715,22 +4676,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 2159 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2160 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 6477 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 2159 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4738,19 +4699,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4795,22 +4756,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 2159 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2160 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 6477 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 720 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 2159 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4818,19 +4779,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 6048 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 2016 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4877,12 +4838,12 @@ LIMIT 10; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2140 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 Vectorized Filter: (_hyper_2_4_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 7 + Rows Removed by Filter: 19 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: ((compress_hyper_6_17_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (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 (never executed) @@ -4917,28 +4878,28 @@ LIMIT 10; Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=9 loops=1) + -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Sort (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6420 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 21 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 57 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2140 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 7 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Rows Removed by Filter: 19 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4992,21 +4953,21 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -5153,18 +5114,18 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk.device_id, _hyper_2_5_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk.device_id, _hyper_2_6_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) @@ -5197,37 +5158,37 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=11755 loops=1) Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 Order: metrics_space."time", metrics_space.device_id Startup Exclusion: false Runtime Exclusion: false - -> Merge Append (actual rows=3355 loops=1) + -> Merge Append (actual rows=6715 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Sort (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Sort (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Sort (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Sort (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 + Rows Removed by Filter: 673 -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=1008 loops=1) @@ -5273,15 +5234,15 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) @@ -5348,14 +5309,18 @@ LIMIT 100; Output: _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."time" 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Sort Key: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_sequence_num + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 + 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=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk."time" Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 -(38 rows) +(42 rows) -- test ordering only by segmentby columns -- should produce ordered path and not have sequence number in targetlist of compressed scan @@ -5400,14 +5365,18 @@ LIMIT 100; Output: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk.device_id_peer 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Sort Key: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer + Sort Method: quicksort + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 + 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 Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=1 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 -(38 rows) +(42 rows) -- should produce ordered path -- only referencing PREFIX_VERBOSE should work @@ -5422,17 +5391,17 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5471,17 +5440,17 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5518,23 +5487,23 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 loops=1) + Sort (actual rows=11755 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time", _hyper_2_7_chunk.v3 Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Append (actual rows=11755 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 + Rows Removed by Filter: 673 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5567,15 +5536,15 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=8395 loops=1) + Merge Append (actual rows=11755 loops=1) Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=671 loops=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=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) @@ -5617,23 +5586,23 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=8395 loops=1) + Sort (actual rows=11755 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Sort Method: quicksort - -> Append (actual rows=8395 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Append (actual rows=11755 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 + Rows Removed by Filter: 673 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -5666,28 +5635,28 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=11755 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=3355 loops=1) + -> Merge Append (actual rows=6715 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=671 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1343 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Sort (actual rows=2013 loops=1) + Rows Removed by Filter: 673 + -> Sort (actual rows=4029 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2013 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=4029 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Sort (actual rows=671 loops=1) + Rows Removed by Filter: 2019 + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=671 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1343 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 + Rows Removed by Filter: 673 -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=1008 loops=1) @@ -5721,7 +5690,7 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=8395 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=11755 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id @@ -5732,7 +5701,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -5740,7 +5709,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -5748,23 +5717,23 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 1 - -> Merge Append (actual rows=3355 loops=1) + Rows Removed by Filter: 3 + -> Merge Append (actual rows=6715 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1343 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=2013 loops=1) + -> Sort (actual rows=4029 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=4029 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=1343 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1343 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id @@ -5798,20 +5767,20 @@ FROM :TEST_TABLE; Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) @@ -5840,34 +5809,34 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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_4_chunk (actual rows=2159 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=3 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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_5_chunk (actual rows=6477 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=9 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) @@ -5901,34 +5870,34 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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_4_chunk (actual rows=2159 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=3 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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_5_chunk (actual rows=6477 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=9 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=6048 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) @@ -5957,34 +5926,34 @@ FROM q ORDER BY v1; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=13680 loops=1) + Sort (actual rows=25915 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=13680 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=13680 loops=1) + -> Subquery Scan on q (actual rows=25915 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=25915 loops=1) Order: metrics_space."time" - -> Merge Append (actual rows=3600 loops=1) + -> Merge Append (actual rows=10795 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Sort (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Sort (actual rows=6477 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Sort (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Merge Append (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Merge Append (actual rows=10080 loops=1) Sort Key: _hyper_2_7_chunk."time" - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=2016 loops=1) -> Merge Append (actual rows=5040 loops=1) Sort Key: _hyper_2_10_chunk."time" -> Sort (actual rows=1008 loops=1) @@ -6021,17 +5990,17 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=2736 loops=1) + Merge Join (actual rows=5183 loops=1) Merge Cond: (metrics_space."time" = metrics_space_1."time") - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2736 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5183 loops=1) Order: metrics_space."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_10_chunk."time" @@ -6039,17 +6008,17 @@ ORDER BY q1.time; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Materialize (actual rows=2736 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=2736 loops=1) + -> Materialize (actual rows=5183 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=5183 loops=1) Order: metrics_space_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 6 + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=2016 loops=1) Index Cond: (device_id = 2) -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time" @@ -6071,11 +6040,11 @@ WHERE device_id = 1; 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_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) @@ -6086,37 +6055,37 @@ WHERE device_id = 1; EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) EXECUTE prep; count ------- - 2736 + 5183 (1 row) DEALLOCATE prep; @@ -6134,19 +6103,19 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 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_device_id_device_id_peer__ts_meta_idx 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=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 @@ -6171,19 +6140,19 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 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_device_id_device_id_peer__ts_meta_idx 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=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.device_id = 1) -> Sort (actual rows=1008 loops=1) @@ -6207,19 +6176,19 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2736 loops=1) + Merge Append (actual rows=5183 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=2159 loops=1) Output: ((test_table_1.*)::metrics_space), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=2159 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_device_id_device_id_peer__ts_meta_idx 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=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=1008 loops=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=2016 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) -> Sort (actual rows=1008 loops=1) @@ -6242,14 +6211,14 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=1008 loops=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=2016 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 @@ -6272,14 +6241,14 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Bulk Decompression: false - -> 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) + -> 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=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=1008 loops=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=2016 loops=1) Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) @@ -6299,30 +6268,30 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=13680 loops=1) + Merge Append (actual rows=25915 loops=1) Sort Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=9 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> 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) + -> 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=3 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) @@ -6472,21 +6441,21 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id_peer = 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 Filter: (compress_hyper_6_18_chunk.device_id_peer = 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 9 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 Filter: (compress_hyper_6_19_chunk.device_id_peer = 1) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> 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) Output: _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk.device_id_peer = 1) @@ -6531,28 +6500,28 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Join Filter: (_hyper_2_4_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 27360 - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Rows Removed by Join Filter: 51830 + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id_peer -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer @@ -6566,7 +6535,7 @@ WHERE device_id_peer IN ( Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) Output: _hyper_2_12_chunk.device_id_peer - -> Materialize (actual rows=2 loops=13680) + -> Materialize (actual rows=2 loops=25915) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6580,14 +6549,14 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) @@ -6607,30 +6576,30 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10366 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id @@ -6707,14 +6676,14 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2736 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + Append (actual rows=5183 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) @@ -6733,30 +6702,30 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=5472 loops=1) + Hash Semi Join (actual rows=10366 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id @@ -6832,18 +6801,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -6876,18 +6845,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6924,11 +6893,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: ((m2."time" = m1."time") AND (m2.device_id = m1.device_id)) + Merge Cond: (m2."time" = m1_1."time") + Join Filter: (m1_1.device_id = m2.device_id) + Rows Removed by Join Filter: 39 -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=10 loops=1) Order: m2."time", m2.device_id -> Merge Append (actual rows=10 loops=1) @@ -6936,18 +6907,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6972,66 +6943,39 @@ FROM :TEST_TABLE m1 -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) - -> Materialize (actual rows=10 loops=1) - -> Merge Join (actual rows=10 loops=1) - Merge Cond: (m1."time" = m3_1."time") - -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) - Order: m1."time", m1.device_id - -> Merge Append (actual rows=10 loops=1) - Sort Key: m1_1."time", m1_1.device_id - -> Sort (actual rows=3 loops=1) - Sort Key: m1_1."time", m1_1.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - -> Sort (actual rows=6 loops=1) - Sort Key: m1_2."time", m1_2.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - -> Sort (actual rows=3 loops=1) - Sort Key: m1_3."time", m1_3.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - -> Merge Append (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) - -> Merge Append (never executed) - Sort Key: m1_7."time", m1_7.device_id - -> Sort (never executed) - Sort Key: m1_7."time", m1_7.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - -> Sort (never executed) - Sort Key: m1_8."time", m1_8.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) - -> Materialize (actual rows=10 loops=1) - -> Merge Append (actual rows=3 loops=1) + -> Materialize (actual rows=49 loops=1) + -> Nested Loop (actual rows=11 loops=1) + Join Filter: (m1_1."time" = m3_1."time") + Rows Removed by Join Filter: 51822 + -> Merge Append (actual rows=3 loops=1) + Sort Key: m3_1."time" + -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" - -> Sort (actual rows=3 loops=1) - Sort Key: m3_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) - Filter: (device_id = 3) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m3_3 (actual rows=1 loops=1) - Filter: (device_id = 3) -(105 rows) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=3 loops=1) + Filter: (device_id = 3) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) + Filter: (device_id = 3) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m3_3 (actual rows=1 loops=1) + Filter: (device_id = 3) + -> Materialize (actual rows=17278 loops=3) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _hyper_2_7_chunk m1_4 (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_8_chunk m1_5 (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_9_chunk m1_6 (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1008 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=3024 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=1008 loops=1) +(80 rows) :PREFIX SELECT * @@ -7054,8 +6998,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_2 (never executed) Filter: (device_id = 1) @@ -7070,10 +7014,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7104,10 +7048,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -7121,10 +7065,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7157,18 +7101,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -7201,18 +7145,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7260,18 +7204,18 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=61 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=21 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7299,21 +7243,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7365,8 +7309,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -7385,21 +7329,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 1 + Rows Removed by Filter: 3 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7451,18 +7395,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7487,18 +7431,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7546,18 +7490,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7582,18 +7526,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7629,9 +7573,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 7 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 408 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) + Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (never executed) Filter: ("time" = g."time") -> Seq Scan on compress_hyper_6_18_chunk (never executed) @@ -7661,7 +7606,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m1_9 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 -(39 rows) +(40 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -7683,9 +7628,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 408 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) + Rows Removed by Filter: 1 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) Heap Fetches: 0 @@ -7694,7 +7640,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_20_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) +(19 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -7706,9 +7652,10 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 336 + Rows Removed by Filter: 408 -> Seq Scan on compress_hyper_6_18_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 Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) Heap Fetches: 0 @@ -7717,7 +7664,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 480 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -(18 rows) +(19 rows) EXECUTE param_prep (1); time | time @@ -7878,34 +7825,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=1008 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=3024 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=1008 loops=1) + -> Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 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=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 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=2016 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=6048 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=2016 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) - -> Append (actual rows=0 loops=13680) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=13680) + -> Append (actual rows=0 loops=25915) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=25915) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 720 - -> 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=13680) + Rows Removed by Filter: 2159 + -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=3 loops=25915) 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=13680) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=25915) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=13680) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=25915) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Rows Removed by Filter: 1008 - -> 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=13680) + -> 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=25915) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -7999,26 +7946,26 @@ $$; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) - -> Merge Append (actual rows=13680 loops=1) + -> Merge Append (actual rows=25915 loops=1) Sort Key: d_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=3600 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=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=10795 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=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=10080 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=15 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=5040 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=10 loops=1) - -> Limit (actual rows=0 loops=13680) - -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=13680) + -> Limit (actual rows=0 loops=25915) + -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=25915) Order: m."time" DESC Hypertables excluded during runtime: 0 - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=13680) - -> 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=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=25915) + -> 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=25915) 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=13680) - -> 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=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=25915) + -> 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=25915) 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=13680) - -> 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=13680) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=25915) + -> 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=25915) Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) (23 rows) @@ -8089,10 +8036,10 @@ PREPARE tableoid_prep AS SELECT tableoid::regclass FROM :TEST_TABLE WHERE device -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 + Rows Removed by Filter: 12 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -9591,12 +9538,12 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; Gather Merge Workers Planned: 4 -> Sort - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk -> Parallel Seq Scan on compress_hyper_5_16_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Parallel Seq Scan on _hyper_1_2_chunk (10 rows) @@ -9604,17 +9551,17 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v QUERY PLAN -------------------------------------------------------------------------------------- Finalize HashAggregate - Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) + Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time")) -> Gather Workers Planned: 4 -> Partial HashAggregate - Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") -> Result -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk -> Parallel Seq Scan on compress_hyper_5_16_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Parallel Seq Scan on _hyper_1_2_chunk (13 rows) @@ -9632,10 +9579,10 @@ EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; -> Parallel Seq Scan on compress_hyper_6_17_chunk -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk -> Parallel Seq Scan on compress_hyper_6_19_chunk - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk - -> Parallel Seq Scan on compress_hyper_6_18_chunk -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk -> Parallel Seq Scan on compress_hyper_6_21_chunk + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk + -> Parallel Seq Scan on compress_hyper_6_18_chunk -> Parallel Seq Scan on _hyper_2_8_chunk -> Parallel Seq Scan on _hyper_2_7_chunk -> Parallel Seq Scan on _hyper_2_9_chunk @@ -9709,12 +9656,12 @@ $sql$ $sql$; -- should have decompresschunk node :PREFIX SELECT * FROM ht_func(); - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------- + Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) @@ -9722,12 +9669,12 @@ $sql$; \c -- plan should be identical to previous plan in fresh session :PREFIX SELECT * FROM ht_func(); - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=13680 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------- + Append (actual rows=25915 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) (6 rows) diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 4bf6077a247..ca7d645de74 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -43,7 +43,7 @@ SELECT time, 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', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', (interval :'INTERVAL') / 3) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics @@ -57,7 +57,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', (interval :'INTERVAL') / 2) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics @@ -103,7 +103,7 @@ SELECT time, 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', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-01 0:00:00+0'::timestamptz, '2000-01-05 23:55:00+0', (interval :'INTERVAL') / 3) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space @@ -117,7 +117,7 @@ SELECT time, device_id + 2, device_id + 0.5, NULL -FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', :'INTERVAL') gtime (time), +FROM generate_series('2000-01-06 0:00:00+0'::timestamptz, '2000-01-12 23:55:00+0', (interval :'INTERVAL') / 2) gtime (time), generate_series(1, 5, 1) gdevice (device_id); ALTER TABLE metrics_space @@ -220,8 +220,6 @@ RESET client_min_messages; SET max_parallel_workers_per_gather TO 0; -select name, setting, unit, source from pg_settings where source != 'default' order by name; - -- get explain for queries on hypertable with compression \set TEST_TABLE 'metrics' \ir :TEST_QUERY_NAME From f80c21a1b8d318d8e402c91d22b0376819ebf393 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 21 May 2024 15:05:40 +0200 Subject: [PATCH 031/157] debug solo test --- tsl/test/sql/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index f93a2219b56..46b4c8a57fb 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -133,6 +133,7 @@ set(SOLO_TESTS cagg_invalidation move reorder + transparent_decompression-${PG_VERSION_MAJOR} telemetry_stats) set(TEST_TEMPLATES From 6343044229fa1e3bd67980315117aa66bd463827 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 21 May 2024 15:06:48 +0200 Subject: [PATCH 032/157] add vacuum --- tsl/test/expected/transparent_decompression-15.out | 2 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index d56300dacb3..a8e1ca7799b 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -70,7 +70,7 @@ SELECT time, NULL FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics; +VACUUM ANALYZE metrics; -- create identical hypertable with space partitioning CREATE TABLE metrics_space ( filler_1 int, diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index ca7d645de74..8b19954116b 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -74,7 +74,7 @@ SELECT time, FROM generate_series('2000-01-13 0:00:00+0'::timestamptz, '2000-01-19 23:55:00+0', :'INTERVAL') gtime (time), generate_series(1, 5, 1) gdevice (device_id); -ANALYZE metrics; +VACUUM ANALYZE metrics; -- create identical hypertable with space partitioning CREATE TABLE metrics_space ( From acc14cf9ae86206492dc7276628a9206c33256c2 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 12:25:43 +0200 Subject: [PATCH 033/157] add some limits --- .../expected/transparent_decompression-15.out | 2862 +++++++++-------- .../transparent_decompression_query.sql | 12 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 3 files changed, 1444 insertions(+), 1432 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index c4dd5adca4e..4ba13c3ab7f 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -35,7 +35,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 10m +\set INTERVAL 20m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, device_id, @@ -215,13 +215,13 @@ LIMIT 5; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 = 1) @@ -244,25 +244,25 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=5183 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=2592 loops=1) Order: metrics."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 8 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=504 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 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: 8 + Rows Removed by Filter: 4 (19 rows) -- test expressions @@ -276,48 +276,45 @@ SELECT time_bucket ('1d', time), FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, - device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Result (actual rows=10366 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=10366 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=4318 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=4318 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=6 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 9 - -> Sort (actual rows=4032 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=4032 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6048 - -> Sort (actual rows=2016 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=2016 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=4 loops=1) + device_id +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Result (actual rows=1000 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=1000 loops=1) + Order: metrics."time", metrics.device_id + -> Sort (actual rows=1000 loops=1) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 6 + -> Sort (never executed) + Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6 -(23 rows) + -> Sort (never executed) + Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) + -> Seq Scan on compress_hyper_5_16_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) +(20 rows) -- test empty targetlist :PREFIX SELECT FROM :TEST_TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) - -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(7 rows) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) +(6 rows) -- test empty resultset :PREFIX @@ -330,116 +327,118 @@ WHERE device_id < 0; -> 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: 15 + Rows Removed by Filter: 10 -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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: 10 + Rows Removed by Filter: 5 (12 rows) -- test targetlist not referencing columns :PREFIX SELECT 1 FROM :TEST_TABLE; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- - Result (actual rows=25915 loops=1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) - -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(8 rows) + QUERY PLAN +------------------------------------------------------------------------------------------ + Result (actual rows=12960 loops=1) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) +(7 rows) -- test constraints not present in targetlist :PREFIX SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=2159 loops=1) +ORDER BY v1 +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_1_1_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 12 - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - 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) + -> Sort (actual rows=1000 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 -(22 rows) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + 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 +(23 rows) -- test order not present in targetlist :PREFIX SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=2159 loops=1) +ORDER BY v1 +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_1_1_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 12 - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - 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) + -> Sort (actual rows=1000 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 -(22 rows) + Rows Removed by Filter: 4032 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + 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 +(23 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE -WHERE device_id = 1; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 12 - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> 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) +WHERE device_id = 1 +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Append (actual rows=1000 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1000 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) - Rows Removed by Filter: 8 -(12 rows) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) + -> Seq Scan on compress_hyper_5_16_chunk (never executed) + Filter: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -465,10 +464,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 10795 - Batches Removed by Filter: 15 + Rows Removed by Filter: 5400 + Batches Removed by Filter: 10 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> Sort (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 @@ -477,7 +476,7 @@ ORDER BY time, -> Seq Scan 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.v3 > '10'::double precision) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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", _hyper_1_3_chunk.device_id @@ -485,10 +484,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_3_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 5040 - Batches Removed by Filter: 10 + Rows Removed by Filter: 2520 + Batches Removed by Filter: 5 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (37 rows) @@ -508,10 +507,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -529,16 +528,16 @@ WHERE device_id IS NOT NULL ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -569,20 +568,20 @@ LIMIT 10; -> 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 IS NULL) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (23 rows) -- test IN (Const,Const) @@ -601,10 +600,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4318 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -632,10 +631,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -664,20 +663,20 @@ LIMIT 10; -> 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 = device_id_peer) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (23 rows) :PREFIX @@ -687,16 +686,16 @@ WHERE device_id_peer < device_id ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -725,10 +724,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 3) -> Sort (never executed) @@ -756,10 +755,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 8636 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 4320 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) -> Sort (never executed) @@ -791,7 +790,7 @@ LIMIT 10; 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)) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (10 rows) :PREFIX @@ -807,12 +806,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=90 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=45 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4910 + Rows Removed by Filter: 4955 -> 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) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (10 rows) :PREFIX @@ -828,12 +827,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=95 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=50 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4905 + Rows Removed by Filter: 4950 -> 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) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (10 rows) :PREFIX @@ -851,10 +850,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10705 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5355 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 90 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 45 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -883,10 +882,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10700 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5350 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 95 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 50 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -915,10 +914,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10700 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5350 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 95 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 50 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -952,13 +951,13 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (v0 < 1) - Rows Removed by Filter: 8064 + Rows Removed by Filter: 4032 -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) @@ -986,11 +985,11 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) Filter: (v0 < device_id) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1007,17 +1006,17 @@ WHERE device_id < v0 ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1050,13 +1049,13 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 -> Sort (actual rows=0 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=0 loops=1) Filter: (v1 = device_id) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1064,7 +1063,7 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (25 rows) --pushdown between two order by column (not pushed down) @@ -1085,21 +1084,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 10795 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 5400 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 5040 - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 2520 + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (23 rows) --pushdown of quals on order by and segment by cols anded together @@ -1124,15 +1123,15 @@ LIMIT 10; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1070 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 Vectorized Filter: (_hyper_1_1_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 19 + Rows Removed by Filter: 10 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: ((compress_hyper_5_15_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (compress_hyper_5_15_chunk.device_id = 1)) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 Index Cond: (_hyper_1_2_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) @@ -1166,10 +1165,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10719 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5360 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 76 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + Rows Removed by Filter: 40 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1189,8 +1188,8 @@ WHERE time < now() ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id @@ -1198,9 +1197,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1226,8 +1225,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Heap Fetches: 0 -> Sort (never executed) @@ -1251,8 +1250,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC, _hyper_1_3_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC, _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1269,25 +1268,25 @@ FROM :TEST_TABLE ORDER BY device_id, time DESC LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk."time" DESC Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (17 rows) -- @@ -1302,28 +1301,28 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=11755 loops=1) + Custom Scan (ChunkAppend) on public.metrics (actual rows=5875 loops=1) Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 Order: metrics."time", metrics.device_id Startup Exclusion: false Runtime Exclusion: false - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=2520 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", _hyper_1_3_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (24 rows) @@ -1340,21 +1339,21 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 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 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1381,10 +1380,10 @@ LIMIT 100; Output: _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."time" Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _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."time" Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 + Rows Removed by Filter: 1685 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1414,10 +1413,10 @@ LIMIT 100; Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 + Rows Removed by Filter: 1685 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1440,21 +1439,21 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1474,21 +1473,21 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) @@ -1506,25 +1505,25 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=2520 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.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 DESC, _hyper_1_3_chunk."time", _hyper_1_3_chunk.v3 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (21 rows) @@ -1542,25 +1541,25 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=10 loops=1) + -> Sort (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, compress_hyper_5_16_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (21 rows) @@ -1577,25 +1576,25 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=6715 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=2520 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.device_id DESC, _hyper_1_3_chunk.device_id_peer DESC, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (21 rows) @@ -1613,20 +1612,20 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=11755 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=5875 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 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=6715 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3355 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 3365 - -> Sort (actual rows=5040 loops=1) + Rows Removed by Filter: 1685 + -> Sort (actual rows=2520 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=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (15 rows) @@ -1640,20 +1639,20 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=11755 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=5875 loops=1) Order: metrics."time", metrics.device_id Chunks excluded during startup: 1 - -> Sort (actual rows=6715 loops=1) + -> Sort (actual rows=3355 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=6715 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3355 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=2520 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=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) (15 rows) @@ -1661,20 +1660,19 @@ ORDER BY time, :PREFIX SELECT count(*) FROM :TEST_TABLE; - 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=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - Heap Fetches: 0 + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) -(11 rows) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) +(10 rows) -- test aggregate with GROUP BY -- Disable hash aggregation to get a deterministic test output @@ -1694,18 +1692,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 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=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 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=10 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=10080 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 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) (20 rows) -- test window functions with GROUP BY @@ -1725,18 +1723,18 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 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=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 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=10 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=10080 loops=1) + -> Sort (actual rows=5040 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 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) (21 rows) SET enable_hashagg = ON; @@ -1749,25 +1747,25 @@ SET enable_hashagg = ON; SELECT * FROM q ORDER BY v1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=25915 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ + Sort (actual rows=12960 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=25915 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=25915 loops=1) + -> Subquery Scan on q (actual rows=12960 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=12960 loops=1) Order: metrics."time" - -> Sort (actual rows=10795 loops=1) + -> Sort (actual rows=5400 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=10080 loops=1) - -> Sort (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Sort (actual rows=2520 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (17 rows) -- test CTE join @@ -1791,47 +1789,47 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=5183 loops=1) + Merge Join (actual rows=2592 loops=1) Merge Cond: (metrics."time" = metrics_1."time") - -> Custom Scan (ChunkAppend) on metrics (actual rows=5183 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=2592 loops=1) Order: metrics."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 8 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=504 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) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 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: 8 - -> Materialize (actual rows=5183 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=5183 loops=1) + Rows Removed by Filter: 4 + -> Materialize (actual rows=2592 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=2592 loops=1) Order: metrics_1."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) 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=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 12 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=2016 loops=1) + Rows Removed by Filter: 8 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=1008 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=504 loops=1) 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=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_1 (actual rows=2 loops=1) + -> 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: 8 + Rows Removed by Filter: 4 (41 rows) -- test prepared statement @@ -1845,55 +1843,55 @@ WHERE device_id = 1; 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=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8064 + Rows Removed by Filter: 4032 -> Partial Aggregate (actual rows=1 loops=1) - -> 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) + -> 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: 8 + Rows Removed by Filter: 4 (16 rows) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) DEALLOCATE prep; @@ -1911,30 +1909,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) + Merge Append (actual rows=2592 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=504 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1948,30 +1946,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) + Merge Append (actual rows=2592 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 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=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 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 = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> Sort (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 Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -1985,30 +1983,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) + Merge Append (actual rows=2592 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Output: ((test_table_1.*)::metrics), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=1080 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=1008 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - Rows Removed by Filter: 8064 - -> Sort (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> Sort (actual rows=504 loops=1) Output: ((test_table_3.*)::metrics), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=1008 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (26 rows) @@ -2021,21 +2019,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) + Append (actual rows=2592 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> 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 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=2 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (17 rows) @@ -2051,21 +2049,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 + Rows Removed by Filter: 4032 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Index Cond: (compress_hyper_5_16_chunk.device_id = 1) (22 rows) @@ -2078,20 +2076,20 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=25915 loops=1) + Merge Append (actual rows=12960 loops=1) Sort Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=5400 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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=15 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=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> 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 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=10 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (15 rows) @@ -2119,7 +2117,7 @@ ORDER BY device_id_peer, -> 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: 10080 + Rows Removed by Filter: 5040 -> 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 @@ -2145,7 +2143,7 @@ ORDER BY device_id_peer; -> 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) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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 @@ -2171,18 +2169,18 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 15 + Rows Removed by Filter: 10 -> 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) - Rows Removed by Filter: 10080 + Rows Removed by Filter: 5040 -> 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) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id_peer = 1) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 (19 rows) --with multiple values can get a nested loop. @@ -2197,21 +2195,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 51830 - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) + Rows Removed by Join Filter: 25920 + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=5400 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=15 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 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=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=25915) + -> Materialize (actual rows=2 loops=12960) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2225,25 +2223,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) + Append (actual rows=2592 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 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=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 12 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 8 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 (19 rows) --with multiple values can get a semi-join or nested loop depending on seq_page_cost. @@ -2255,28 +2253,34 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10366 loops=1) + Nested Loop (actual rows=5184 loops=1) Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) + -> Unique (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Sort (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + Sort Method: quicksort + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Append (actual rows=2592 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 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=2 loops=2) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) + Rows Removed by Filter: 4032 + -> 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Hash (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Buckets: 1024 Batches: 1 - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 -(21 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(27 rows) SET seq_page_cost = 100; -- loop/row counts of this query is different on windows so we run it without analyze @@ -2316,25 +2320,25 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=2159 loops=1) + Append (actual rows=2592 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 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=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 12 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 8 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 8064 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4032 + -> 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk.device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 (19 rows) :PREFIX_VERBOSE @@ -2345,28 +2349,34 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10366 loops=1) + Nested Loop (actual rows=5184 loops=1) Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=10795 loops=1) + -> Unique (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Sort (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + Sort Method: quicksort + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Append (actual rows=2592 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=15 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=2 loops=2) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=10080 loops=1) + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=5040 loops=1) + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) + Rows Removed by Filter: 4032 + -> 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=10 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=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Hash (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Buckets: 1024 Batches: 1 - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 -(21 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(27 rows) -- test view CREATE OR REPLACE VIEW compressed_view AS @@ -2389,10 +2399,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> 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) + -> 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: 8 + Rows Removed by Filter: 4 -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2421,8 +2431,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2433,16 +2443,16 @@ FROM :TEST_TABLE m1 -> 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: 1942 - -> 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=3 loops=10) + Rows Removed by Filter: 971 + -> 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=2 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: 1008 - -> 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=2 loops=9) + 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) @@ -2467,8 +2477,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2479,16 +2489,16 @@ FROM :TEST_TABLE m1 -> 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: 1942 - -> 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=3 loops=10) + Rows Removed by Filter: 971 + -> 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=2 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: 1008 - -> 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=2 loops=9) + 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) -> Materialize (actual rows=10 loops=1) -> Merge Append (actual rows=3 loops=1) @@ -2496,20 +2506,20 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=2 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> 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 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk compress_hyper_5_16_chunk_2 (actual rows=2 loops=1) + -> 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: 8 + Rows Removed by Filter: 4 (52 rows) :PREFIX @@ -2533,10 +2543,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2550,10 +2560,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> 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) @@ -2584,10 +2594,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2601,10 +2611,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -2629,14 +2639,14 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 38 + Rows Removed by Join Filter: 39 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2644,14 +2654,14 @@ LIMIT 10; 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=48 loops=1) + -> Materialize (actual rows=49 loops=1) -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=11 loops=1) Order: m2."time" -> Sort (actual rows=11 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2686,8 +2696,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2701,10 +2711,10 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> 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) @@ -2741,8 +2751,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2761,21 +2771,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2825,8 +2835,8 @@ LIMIT 20; -> Sort (actual rows=5 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2840,8 +2850,8 @@ LIMIT 20; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2876,8 +2886,8 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2891,8 +2901,8 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2917,19 +2927,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 408 + Rows Removed by Filter: 504 -> 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")) - Rows Removed by Filter: 1 -> Index Only 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") Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + 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")) -(19 rows) +(18 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -2951,19 +2960,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 408 + Rows Removed by Filter: 504 -> 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)) - Rows Removed by Filter: 1 -> 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: 480 + 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)) -(19 rows) +(18 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -2975,20 +2983,20 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 408 + Rows Removed by Filter: 504 -> 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: 4 + Rows Removed by Filter: 2 -> 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) Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + 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: 2 + Rows Removed by Filter: 1 (21 rows) EXECUTE param_prep (1); @@ -3150,34 +3158,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 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=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 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=9 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 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=2016 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=6048 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=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) - -> Append (actual rows=0 loops=25915) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=25915) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 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=1008 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=3024 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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_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=12960) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=12960) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 2159 - -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=3 loops=25915) + Rows Removed by Filter: 1080 + -> 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=12960) 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=25915) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=12960) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=25915) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=12960) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1008 - -> 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=25915) + 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 (actual rows=1 loops=12960) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -3212,10 +3220,10 @@ LIMIT 5; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (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 (never executed) @@ -3240,21 +3248,21 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=5183 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=2592 loops=1) Order: metrics_space."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) (16 rows) @@ -3269,55 +3277,52 @@ SELECT time_bucket ('1d', time), FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, - device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- - Result (actual rows=10366 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10366 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=4318 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=2159 loops=1) + device_id +LIMIT 1000; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=1000 loops=1) + -> Result (actual rows=1000 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=1000 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=2159 loops=1) - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6 - -> Merge Append (actual rows=4032 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=501 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=500 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 4 + -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (actual rows=2016 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) + -> Sort (never executed) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 4 -(45 rows) + -> Sort (never executed) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Merge Append (never executed) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (never executed) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (never executed) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) +(41 rows) -- test empty targetlist :PREFIX @@ -3325,21 +3330,21 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) (15 rows) -- test empty resultset @@ -3353,15 +3358,15 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) @@ -3371,11 +3376,11 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) (29 rows) @@ -3386,22 +3391,22 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=25915 loops=1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + Result (actual rows=12960 loops=1) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) (16 rows) -- test constraints not present in targetlist @@ -3409,76 +3414,82 @@ FROM :TEST_TABLE; SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1; - QUERY PLAN -------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=2159 loops=1) +ORDER BY v1 +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1000 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(20 rows) -- test order not present in targetlist :PREFIX SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1; - QUERY PLAN -------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=2159 loops=1) +ORDER BY v1 +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Sort (actual rows=1000 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(20 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE -WHERE device_id = 1; - QUERY PLAN -------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) - Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) +WHERE device_id = 1 +LIMIT 1000; + QUERY PLAN +------------------------------------------------------------------------------------------ + Limit (actual rows=1000 loops=1) + -> Append (actual rows=1000 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1000 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) -(9 rows) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -3506,10 +3517,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2159 - Batches Removed by Filter: 3 + Rows Removed by Filter: 1080 + Batches Removed by Filter: 2 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 -> Sort (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 @@ -3518,10 +3529,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 6477 - Batches Removed by Filter: 9 + Rows Removed by Filter: 3240 + Batches Removed by Filter: 6 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 -> Sort (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 @@ -3530,10 +3541,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2159 - Batches Removed by Filter: 3 + Rows Removed by Filter: 1080 + Batches Removed by Filter: 2 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3544,7 +3555,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id @@ -3552,7 +3563,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id @@ -3560,7 +3571,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3570,10 +3581,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 - Batches Removed by Filter: 2 + Rows Removed by Filter: 504 + Batches Removed by Filter: 1 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 -> Sort (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 @@ -3582,10 +3593,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3024 - Batches Removed by Filter: 6 + Rows Removed by Filter: 1512 + Batches Removed by Filter: 3 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 -> Sort (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 @@ -3594,7 +3605,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 504 (103 rows) -- device_id constraint should be pushed down @@ -3613,8 +3624,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3643,20 +3654,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3710,21 +3721,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3750,14 +3761,14 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -3783,16 +3794,16 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=5 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -3833,8 +3844,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3866,21 +3877,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3888,19 +3899,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3909,20 +3920,20 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 504 (68 rows) :PREFIX @@ -3942,20 +3953,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4005,8 +4016,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) Filter: (device_id = 3) @@ -4035,21 +4046,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 2159 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1080 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 6477 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 3240 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (never executed) @@ -4098,7 +4109,7 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 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)) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 2997 @@ -4107,7 +4118,7 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 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)) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) Rows Removed by Filter: 999 @@ -4116,7 +4127,7 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 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)) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 (30 rows) :PREFIX @@ -4136,30 +4147,30 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=9 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 982 + Rows Removed by Filter: 991 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=54 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=27 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2946 + Rows Removed by Filter: 2973 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=18 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=9 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 982 + Rows Removed by Filter: 991 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 (32 rows) :PREFIX @@ -4179,30 +4190,30 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=19 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=10 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 981 + Rows Removed by Filter: 990 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=57 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=30 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2943 + Rows Removed by Filter: 2970 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=19 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=10 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 981 + Rows Removed by Filter: 990 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 (32 rows) :PREFIX @@ -4222,26 +4233,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2141 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1071 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 18 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 9 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6423 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3213 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 54 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 27 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2141 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1071 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 18 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 9 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4294,26 +4305,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1070 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 19 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 10 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6420 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3210 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 57 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 30 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1070 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 19 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 10 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4366,26 +4377,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1070 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 19 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 10 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6420 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3210 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 57 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 30 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1070 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 19 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 10 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4443,7 +4454,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4451,7 +4462,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4459,7 +4470,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4486,7 +4497,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4494,7 +4505,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort @@ -4523,7 +4534,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4531,7 +4542,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4539,7 +4550,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4547,19 +4558,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4569,7 +4580,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort @@ -4577,13 +4588,13 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 504 (73 rows) :PREFIX @@ -4603,23 +4614,23 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4674,22 +4685,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2159 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1080 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 6477 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 3240 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2159 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1080 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4697,19 +4708,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4717,21 +4728,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 504 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 3024 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 1512 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 504 (68 rows) --pushdown between two order by column (not pushed down) @@ -4754,22 +4765,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2159 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1080 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 6477 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 3240 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2159 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 1080 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4777,19 +4788,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 6048 + Rows Removed by Filter: 3024 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + Rows Removed by Filter: 1008 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4797,21 +4808,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 504 + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 3024 - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 1512 + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 504 (68 rows) --pushdown of quals on order by and segment by cols anded together @@ -4836,12 +4847,12 @@ LIMIT 10; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1070 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 Vectorized Filter: (_hyper_2_4_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 19 + Rows Removed by Filter: 10 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: ((compress_hyper_6_17_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (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 (never executed) @@ -4879,23 +4890,23 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6420 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3210 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 57 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + Rows Removed by Filter: 30 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2140 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1070 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 19 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + Rows Removed by Filter: 10 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -4946,21 +4957,21 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -5011,13 +5022,13 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Only Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5064,13 +5075,13 @@ LIMIT 10; -> Sort (actual rows=7 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC, _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC, _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC -> Index Scan using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) @@ -5107,18 +5118,18 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk.device_id, _hyper_2_5_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk.device_id, _hyper_2_6_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) @@ -5128,13 +5139,13 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) Heap Fetches: 0 (36 rows) @@ -5151,66 +5162,66 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=11755 loops=1) + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=5875 loops=1) Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 Order: metrics_space."time", metrics_space.device_id Startup Exclusion: false Runtime Exclusion: false - -> Merge Append (actual rows=6715 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Sort (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Sort (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Sort (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Sort (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Merge Append (actual rows=5040 loops=1) + Rows Removed by Filter: 337 + -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (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 Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=3024 loops=1) + -> Sort (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 Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (62 rows) @@ -5227,32 +5238,32 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1008 loops=1) + -> 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) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (28 rows) @@ -5295,7 +5306,7 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) @@ -5306,7 +5317,7 @@ LIMIT 100; Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Sort Key: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1 loops=1) @@ -5351,7 +5362,7 @@ LIMIT 100; Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1 loops=1) @@ -5362,7 +5373,7 @@ LIMIT 100; Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Sort Key: compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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 Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=1 loops=1) @@ -5384,35 +5395,35 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1008 loops=1) + -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5433,35 +5444,35 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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=1008 loops=1) + -> 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) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5480,38 +5491,38 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=11755 loops=1) + Sort (actual rows=5875 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time", _hyper_2_7_chunk.v3 Sort Method: quicksort - -> Append (actual rows=11755 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Append (actual rows=5875 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 337 + -> 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5529,40 +5540,40 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=11755 loops=1) + Merge Append (actual rows=5875 loops=1) Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=1343 loops=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=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Sort (actual rows=2 loops=1) + -> Sort (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, compress_hyper_6_20_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> 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 - -> Sort (actual rows=6 loops=1) + -> Sort (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, compress_hyper_6_21_chunk._ts_meta_sequence_num Sort Method: quicksort - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=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=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (36 rows) @@ -5579,38 +5590,38 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=11755 loops=1) + Sort (actual rows=5875 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Sort Method: quicksort - -> Append (actual rows=11755 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1343 loops=1) + -> Append (actual rows=5875 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 337 + -> 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=3024 loops=1) + -> 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5628,48 +5639,48 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=11755 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=5875 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=6715 loops=1) + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1343 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=671 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Sort (actual rows=4029 loops=1) + Rows Removed by Filter: 337 + -> Sort (actual rows=2013 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=4029 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2013 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 2019 - -> Sort (actual rows=1343 loops=1) + Rows Removed by Filter: 1011 + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1343 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=671 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 673 - -> Merge Append (actual rows=5040 loops=1) + Rows Removed by Filter: 337 + -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=1512 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (43 rows) @@ -5683,7 +5694,7 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=11755 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=5875 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id @@ -5694,7 +5705,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -5702,7 +5713,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -5710,44 +5721,44 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 3 - -> Merge Append (actual rows=6715 loops=1) + Rows Removed by Filter: 2 + -> Merge Append (actual rows=3355 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1343 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=671 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=4029 loops=1) + -> Sort (actual rows=2013 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=4029 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2013 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=1343 loops=1) + -> Sort (actual rows=671 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1343 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=671 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Merge Append (actual rows=5040 loops=1) + -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=1512 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) (66 rows) @@ -5760,28 +5771,28 @@ FROM :TEST_TABLE; Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) (25 rows) -- test aggregate with GROUP BY @@ -5802,48 +5813,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 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=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) (50 rows) -- test window functions with GROUP BY @@ -5863,48 +5874,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 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=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=6048 loops=1) + -> Sort (actual rows=3024 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=2016 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) (51 rows) SET enable_hashagg = ON; @@ -5917,49 +5928,49 @@ SET enable_hashagg = ON; SELECT * FROM q ORDER BY v1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=25915 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=12960 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=25915 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=25915 loops=1) + -> Subquery Scan on q (actual rows=12960 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=12960 loops=1) Order: metrics_space."time" - -> Merge Append (actual rows=10795 loops=1) + -> Merge Append (actual rows=5400 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - -> Sort (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Sort (actual rows=3240 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) - -> Sort (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) - -> Merge Append (actual rows=10080 loops=1) - Sort Key: _hyper_2_7_chunk."time" - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=6048 loops=1) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=2016 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (actual rows=5040 loops=1) + Sort Key: _hyper_2_7_chunk."time" + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Merge Append (actual rows=2520 loops=1) Sort Key: _hyper_2_10_chunk."time" - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Sort (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Sort (actual rows=1512 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=504 loops=1) (41 rows) -- test CTE join @@ -5983,43 +5994,43 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=5183 loops=1) + Merge Join (actual rows=2592 loops=1) Merge Cond: (metrics_space."time" = metrics_space_1."time") - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=5183 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2592 loops=1) Order: metrics_space."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Materialize (actual rows=5183 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=5183 loops=1) + -> Materialize (actual rows=2592 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=2592 loops=1) Order: metrics_space_1."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=2016 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1008 loops=1) Index Cond: (device_id = 2) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 (37 rows) -- test prepared statement @@ -6028,57 +6039,57 @@ 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_2_4_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) (13 rows) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) EXECUTE prep; count ------- - 5183 + 2592 (1 row) DEALLOCATE prep; @@ -6096,30 +6107,30 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) + Merge Append (actual rows=2592 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (26 rows) @@ -6133,29 +6144,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) + Merge Append (actual rows=2592 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=2016 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (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 Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6169,29 +6180,29 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5183 loops=1) + Merge Append (actual rows=2592 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=2159 loops=1) + -> Sort (actual rows=1080 loops=1) Output: ((test_table_1.*)::metrics_space), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=1080 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=2016 loops=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=1008 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=504 loops=1) Output: ((test_table_3.*)::metrics_space), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=1008 loops=1) + -> 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (25 rows) @@ -6204,21 +6215,21 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + Append (actual rows=2592 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=2016 loops=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=1008 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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 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=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (17 rows) @@ -6234,21 +6245,21 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=2016 loops=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=1008 loops=1) Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Index Cond: (compress_hyper_6_20_chunk.device_id = 1) (22 rows) @@ -6261,43 +6272,43 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=25915 loops=1) + Merge Append (actual rows=12960 loops=1) Sort Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> 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=9 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=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> 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=3 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=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> 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 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=2 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> 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 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=6 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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> 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: 0 (39 rows) @@ -6434,21 +6445,21 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id_peer = 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 Filter: (compress_hyper_6_18_chunk.device_id_peer = 1) - Rows Removed by Filter: 9 + Rows Removed by Filter: 6 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 Filter: (compress_hyper_6_19_chunk.device_id_peer = 1) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> 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) Output: _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk.device_id_peer = 1) @@ -6467,14 +6478,14 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=0 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id_peer = 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=0 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk.device_id_peer = 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> 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) Output: _hyper_2_12_chunk.device_id_peer Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) @@ -6493,42 +6504,42 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Join Filter: (_hyper_2_4_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 51830 - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + Rows Removed by Join Filter: 25920 + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id_peer - -> Materialize (actual rows=2 loops=25915) + -> Materialize (actual rows=2 loops=12960) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6542,20 +6553,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + Append (actual rows=2592 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6569,42 +6580,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10366 loops=1) + Hash Semi Join (actual rows=5184 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6669,20 +6680,20 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=5183 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + Append (actual rows=2592 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk.device_id = 1) (16 rows) @@ -6695,42 +6706,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=10366 loops=1) + Hash Semi Join (actual rows=5184 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=2159 loops=1) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=6477 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=2159 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=6048 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=2016 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=3024 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6760,8 +6771,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -6794,18 +6805,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -6838,18 +6849,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6900,18 +6911,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6939,35 +6950,35 @@ FROM :TEST_TABLE m1 -> Materialize (actual rows=49 loops=1) -> Nested Loop (actual rows=11 loops=1) Join Filter: (m1_1."time" = m3_1."time") - Rows Removed by Join Filter: 51822 + Rows Removed by Join Filter: 25912 -> 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 - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=2 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m3_3 (actual rows=1 loops=1) Filter: (device_id = 3) - -> Materialize (actual rows=17278 loops=3) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_7_chunk m1_4 (actual rows=2016 loops=1) - -> Seq Scan on _hyper_2_8_chunk m1_5 (actual rows=6048 loops=1) - -> Seq Scan on _hyper_2_9_chunk m1_6 (actual rows=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1008 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=3024 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=6 loops=1) - -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=1008 loops=1) + -> Materialize (actual rows=8641 loops=3) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _hyper_2_7_chunk m1_4 (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_8_chunk m1_5 (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_9_chunk m1_6 (actual rows=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=504 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1512 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=504 loops=1) (80 rows) :PREFIX @@ -6991,8 +7002,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_2 (never executed) Filter: (device_id = 1) @@ -7007,10 +7018,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7041,10 +7052,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -7058,10 +7069,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7086,7 +7097,7 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 39 + Rows Removed by Join Filter: 40 -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Merge Append (actual rows=10 loops=1) @@ -7094,18 +7105,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -7130,7 +7141,7 @@ LIMIT 10; -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) - -> Materialize (actual rows=49 loops=1) + -> Materialize (actual rows=50 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" -> Merge Append (actual rows=11 loops=1) @@ -7138,18 +7149,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7197,18 +7208,18 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=61 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=21 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7236,21 +7247,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7302,8 +7313,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -7322,21 +7333,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 6 + Rows Removed by Filter: 4 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 3 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7388,18 +7399,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7424,18 +7435,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7483,18 +7494,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7519,18 +7530,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=6477 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7566,10 +7577,9 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 7 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 408 + Rows Removed by Filter: 504 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) - Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (never executed) Filter: ("time" = g."time") -> Seq Scan on compress_hyper_6_18_chunk (never executed) @@ -7589,7 +7599,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 240 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) @@ -7599,7 +7609,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': -> Index Only Scan using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m1_9 (never executed) Index Cond: ("time" = g."time") Heap Fetches: 0 -(40 rows) +(39 rows) -- test prepared statement with params pushdown PREPARE param_prep (int) AS @@ -7621,19 +7631,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 408 + Rows Removed by Filter: 504 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) - Rows Removed by Filter: 1 -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 1) AND ("time" = g."time")) Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 240 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 1)) -(19 rows) +(18 rows) :PREFIX EXECUTE param_prep (2); QUERY PLAN @@ -7645,19 +7654,18 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 408 + Rows Removed by Filter: 504 -> Seq Scan on compress_hyper_6_18_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 Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) Index Cond: ((device_id = 2) AND ("time" = g."time")) Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 480 + Rows Removed by Filter: 240 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -(19 rows) +(18 rows) EXECUTE param_prep (1); time | time @@ -7818,34 +7826,34 @@ WHERE metrics.time > metrics_space.time QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (actual rows=0 loops=1) - -> Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=2159 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=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=6477 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=9 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=2159 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=3 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=2016 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=6048 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=2016 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=1008 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=3024 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=6 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=1008 loops=1) - -> Append (actual rows=0 loops=25915) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=25915) + -> Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 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=1008 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=3024 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=1008 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 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_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=12960) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=12960) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 2159 - -> Index Scan using compress_hyper_5_15_chunk_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_15_chunk (actual rows=3 loops=25915) + Rows Removed by Filter: 1080 + -> 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=12960) 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=25915) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=12960) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=25915) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=12960) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1008 - -> 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=25915) + 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 (actual rows=1 loops=12960) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -7902,10 +7910,10 @@ $$; -> Custom Scan (ChunkAppend) on metrics_ordered (actual rows=10 loops=1) Order: metrics_ordered."time" DESC -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk (actual rows=10 loops=1) - -> Sort (actual rows=6 loops=1) + -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_12_31_chunk._ts_meta_max_1 DESC Sort Method: quicksort - -> Seq Scan on compress_hyper_12_31_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_12_31_chunk (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk (never executed) -> Sort (never executed) Sort Key: compress_hyper_12_30_chunk._ts_meta_max_1 DESC @@ -7939,26 +7947,26 @@ $$; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (actual rows=0 loops=1) -> Nested Loop (actual rows=0 loops=1) - -> Merge Append (actual rows=25915 loops=1) + -> Merge Append (actual rows=12960 loops=1) Sort Key: d_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=10795 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=15 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=10080 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=15 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=5040 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=10 loops=1) - -> Limit (actual rows=0 loops=25915) - -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=25915) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=5400 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=5040 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=10 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_device_id_device_id_peer__ts_met_idx on compress_hyper_12_31_chunk (actual rows=5 loops=1) + -> Limit (actual rows=0 loops=12960) + -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=12960) Order: m."time" DESC Hypertables excluded during runtime: 0 - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=25915) - -> 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=25915) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=12960) + -> 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=12960) 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=25915) - -> 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=25915) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=12960) + -> 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=12960) 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=25915) - -> 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=25915) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=12960) + -> 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=12960) Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) (23 rows) @@ -8029,10 +8037,10 @@ PREPARE tableoid_prep AS SELECT tableoid::regclass FROM :TEST_TABLE WHERE device -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2159 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 12 + Rows Removed by Filter: 8 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -9559,19 +9567,19 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v (13 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; - QUERY PLAN -------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------ Gather Merge Workers Planned: 4 -> Sort - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk - -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk -> Parallel Seq Scan on compress_hyper_6_17_chunk -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk -> Parallel Seq Scan on compress_hyper_6_19_chunk + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk + -> Parallel Seq Scan on compress_hyper_6_20_chunk -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk -> Parallel Seq Scan on compress_hyper_6_21_chunk -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk @@ -9649,27 +9657,27 @@ $sql$ $sql$; -- should have decompresschunk node :PREFIX SELECT * FROM ht_func(); - QUERY PLAN -------------------------------------------------------------------------------------- - Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (6 rows) \c -- plan should be identical to previous plan in fresh session :PREFIX SELECT * FROM ht_func(); - QUERY PLAN -------------------------------------------------------------------------------------- - Append (actual rows=25915 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=10795 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=15 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=10080 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=5040 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=10 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=12960 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (6 rows) -- repro for core dump related to total_table_pages setting that get diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index e72a3651f1e..fb5e1891a66 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -28,7 +28,8 @@ SELECT time_bucket ('1d', time), FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, - device_id; + device_id +LIMIT 1000; -- test empty targetlist :PREFIX @@ -51,20 +52,23 @@ FROM :TEST_TABLE; SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1; +ORDER BY v1 +LIMIT 1000; -- test order not present in targetlist :PREFIX SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1; +ORDER BY v1 +LIMIT 1000; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE -WHERE device_id = 1; +WHERE device_id = 1 +LIMIT 1000; -- -- test qual pushdown diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 8b19954116b..78200a4fd9c 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -33,7 +33,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 10m +\set INTERVAL 30m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, From bdc0ceb7b9bafddd4d176d2440866d7f964038f6 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 12:39:20 +0200 Subject: [PATCH 034/157] ref --- .../expected/transparent_decompression-15.out | 2314 ++++++++--------- 1 file changed, 1146 insertions(+), 1168 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 4ba13c3ab7f..30c9f83d271 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -35,7 +35,7 @@ SELECT create_hypertable ('metrics', 'time'); ALTER TABLE metrics DROP COLUMN filler_1; -\set INTERVAL 20m +\set INTERVAL 30m INSERT INTO metrics (time, device_id, device_id_peer, v0, v1, v2, v3) SELECT time, device_id, @@ -215,13 +215,13 @@ LIMIT 5; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 = 1) @@ -242,24 +242,24 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=2592 loops=1) + QUERY PLAN +----------------------------------------------------------------------------------------------------------------- + Custom Scan (ChunkAppend) on metrics (actual rows=1728 loops=1) Order: metrics."time" - -> Sort (actual rows=1080 loops=1) + -> 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=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -286,11 +286,11 @@ LIMIT 1000; Order: metrics."time", metrics.device_id -> Sort (actual rows=1000 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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: 6 + Rows Removed by Filter: 3 -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -308,11 +308,11 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (6 rows) @@ -327,10 +327,10 @@ WHERE device_id < 0; -> 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: 10 + Rows Removed by Filter: 5 -> Seq Scan on _hyper_1_2_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> 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) @@ -343,12 +343,12 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------ - Result (actual rows=12960 loops=1) - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + Result (actual rows=8640 loops=1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (7 rows) @@ -359,28 +359,28 @@ FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 LIMIT 1000; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------- Limit (actual rows=1000 loops=1) -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=1000 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=280 loops=1) Sort Key: _hyper_1_3_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -393,28 +393,28 @@ FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 LIMIT 1000; - QUERY PLAN ------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------- Limit (actual rows=1000 loops=1) -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=1000 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=1 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=280 loops=1) Sort Key: _hyper_1_3_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -426,19 +426,20 @@ SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 LIMIT 1000; - QUERY PLAN ------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------- Limit (actual rows=1000 loops=1) -> Append (actual rows=1000 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1000 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_1_2_chunk (never executed) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=280 loops=1) Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) -(10 rows) +(11 rows) -- -- test qual pushdown @@ -464,10 +465,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 5400 - Batches Removed by Filter: 10 + Rows Removed by Filter: 3600 + Batches Removed by Filter: 5 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 -> Sort (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 @@ -476,7 +477,7 @@ ORDER BY time, -> Seq Scan 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.v3 > '10'::double precision) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> 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", _hyper_1_3_chunk.device_id @@ -484,7 +485,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_1_3_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 1680 Batches Removed by Filter: 5 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) @@ -507,10 +508,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -536,8 +537,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -568,13 +569,13 @@ LIMIT 10; -> 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 IS NULL) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -600,10 +601,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=4 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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: 6 + Rows Removed by Filter: 3 -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -631,10 +632,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -663,13 +664,13 @@ LIMIT 10; -> 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 = device_id_peer) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=0 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=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -694,8 +695,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -724,10 +725,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 3) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 3) -> Sort (never executed) @@ -755,10 +756,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 4320 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 2880 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) -> Sort (never executed) @@ -784,14 +785,13 @@ LIMIT 10; 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: 4995 + Rows Removed by Filter: 3595 -> 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)) - Rows Removed by Filter: 5 -(10 rows) +(9 rows) :PREFIX SELECT * @@ -806,13 +806,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=45 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=30 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4955 + Rows Removed by Filter: 3570 -> 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) - Rows Removed by Filter: 5 -(10 rows) +(9 rows) :PREFIX SELECT * @@ -827,13 +826,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=50 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=35 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 4950 + Rows Removed by Filter: 3565 -> 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) - Rows Removed by Filter: 5 -(10 rows) +(9 rows) :PREFIX SELECT * @@ -850,10 +848,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5355 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3570 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 45 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 30 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -882,10 +880,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5350 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 50 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 35 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -914,10 +912,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5350 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3565 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 50 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 35 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -951,13 +949,13 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (v0 < 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 2688 -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) @@ -985,11 +983,11 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) Filter: (v0 < device_id) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id @@ -1014,9 +1012,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id @@ -1049,13 +1047,13 @@ LIMIT 10; Filter: (v1 = device_id) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=0 loops=1) Filter: ((_ts_meta_min_2 <= device_id) AND (_ts_meta_max_2 >= device_id)) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> Sort (actual rows=0 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=0 loops=1) Filter: (v1 = device_id) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Method: quicksort @@ -1084,20 +1082,20 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 5400 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 3600 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> Sort (actual rows=0 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=0 loops=1) Filter: (v0 = v1) - Rows Removed by Filter: 2520 + Rows Removed by Filter: 1680 -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (23 rows) @@ -1123,15 +1121,15 @@ LIMIT 10; 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: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=713 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 Vectorized Filter: (_hyper_1_1_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 10 + Rows Removed by Filter: 7 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: ((compress_hyper_5_15_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (compress_hyper_5_15_chunk.device_id = 1)) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (never executed) 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 Index Cond: (_hyper_1_2_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) @@ -1165,10 +1163,10 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3572 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 40 - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + Rows Removed by Filter: 28 + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1197,9 +1195,9 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1225,7 +1223,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Heap Fetches: 0 @@ -1250,7 +1248,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC, _hyper_1_3_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC, _hyper_1_2_chunk.device_id @@ -1276,16 +1274,16 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk.device_id, _hyper_1_1_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk."time" DESC Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk.device_id, _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (17 rows) @@ -1301,24 +1299,24 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=5875 loops=1) + Custom Scan (ChunkAppend) on public.metrics (actual rows=3915 loops=1) Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 Order: metrics."time", metrics.device_id Startup Exclusion: false Runtime Exclusion: false - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 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 Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Sort (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Sort (actual rows=1680 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", _hyper_1_3_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true @@ -1339,17 +1337,17 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true @@ -1380,10 +1378,10 @@ LIMIT 100; Output: _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."time" Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 loops=1) Output: _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."time" Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 1125 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1413,10 +1411,10 @@ LIMIT 100; Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Sort Method: top-N heapsort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 + Rows Removed by Filter: 1125 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1 loops=1) 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) @@ -1439,17 +1437,17 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) 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 @@ -1473,17 +1471,17 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 loops=1) Output: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 Filter: (_hyper_1_2_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) 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 @@ -1505,21 +1503,21 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Sort (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Sort (actual rows=1680 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.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 DESC, _hyper_1_3_chunk."time", _hyper_1_3_chunk.v3 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true @@ -1541,17 +1539,17 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true @@ -1576,21 +1574,21 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3355 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Sort (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Sort (actual rows=1680 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.device_id DESC, _hyper_1_3_chunk.device_id_peer DESC, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true @@ -1612,18 +1610,18 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=5875 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=3915 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 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=3355 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2235 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1685 - -> Sort (actual rows=2520 loops=1) + Rows Removed by Filter: 1125 + -> Sort (actual rows=1680 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=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1639,18 +1637,18 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics (actual rows=5875 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=3915 loops=1) Order: metrics."time", metrics.device_id Chunks excluded during startup: 1 - -> Sort (actual rows=3355 loops=1) + -> Sort (actual rows=2235 loops=1) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3355 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=2235 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=2520 loops=1) + -> Sort (actual rows=1680 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=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) @@ -1665,12 +1663,12 @@ FROM :TEST_TABLE; 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=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (10 rows) @@ -1682,8 +1680,8 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id -> Sort (actual rows=15 loops=1) @@ -1692,17 +1690,17 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=3360 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) (20 rows) @@ -1712,8 +1710,8 @@ SELECT sum(count(*)) OVER () FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- WindowAgg (actual rows=5 loops=1) -> Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id @@ -1723,17 +1721,17 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 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=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=5040 loops=1) + -> Sort (actual rows=3360 loops=1) Sort Key: _hyper_1_2_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) (21 rows) @@ -1749,22 +1747,22 @@ FROM q ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Sort (actual rows=12960 loops=1) + Sort (actual rows=8640 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=12960 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=12960 loops=1) + -> Subquery Scan on q (actual rows=8640 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=8640 loops=1) Order: metrics."time" - -> Sort (actual rows=5400 loops=1) + -> Sort (actual rows=3600 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Sort (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Sort (actual rows=1680 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (17 rows) @@ -1787,46 +1785,46 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=2592 loops=1) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ + Merge Join (actual rows=1728 loops=1) Merge Cond: (metrics."time" = metrics_1."time") - -> Custom Scan (ChunkAppend) on metrics (actual rows=2592 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=1728 loops=1) Order: metrics."time" - -> Sort (actual rows=1080 loops=1) + -> 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=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Materialize (actual rows=2592 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=2592 loops=1) + -> Materialize (actual rows=1728 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1728 loops=1) Order: metrics_1."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) 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=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=720 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: 8 - -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=1008 loops=1) + Rows Removed by Filter: 4 + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=672 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4032 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=336 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 @@ -1838,21 +1836,21 @@ 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=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 2688 -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -1861,37 +1859,37 @@ WHERE device_id = 1; EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) DEALLOCATE prep; @@ -1909,27 +1907,27 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2592 loops=1) + Merge Append (actual rows=1728 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Key: _hyper_1_1_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) @@ -1946,27 +1944,27 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2592 loops=1) + Merge Append (actual rows=1728 loops=1) Sort Key: _hyper_1_1_chunk."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 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=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 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 = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 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=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) @@ -1983,27 +1981,27 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2592 loops=1) + Merge Append (actual rows=1728 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Output: ((test_table_1.*)::metrics), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk test_table_1 (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _timescaledb_internal._hyper_1_2_chunk test_table_2 (actual rows=672 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - Rows Removed by Filter: 4032 - -> Sort (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) Output: ((test_table_3.*)::metrics), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk test_table_3 (actual rows=336 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=1) @@ -2019,18 +2017,18 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2592 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false -> 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) @@ -2049,19 +2047,19 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=1) Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Index Cond: (compress_hyper_5_15_chunk.device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 + Rows Removed by Filter: 2688 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 loops=1) Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 @@ -2076,17 +2074,17 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=12960 loops=1) + Merge Append (actual rows=8640 loops=1) Sort Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=5400 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) Output: _hyper_1_1_chunk.device_id Bulk Decompression: false - -> 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=10 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=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) + -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false -> 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) @@ -2117,7 +2115,7 @@ ORDER BY device_id_peer, -> 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: 5040 + Rows Removed by Filter: 3360 -> 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 @@ -2143,7 +2141,7 @@ ORDER BY device_id_peer; -> 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) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> 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 @@ -2169,11 +2167,11 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=0 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id_peer = 1) - Rows Removed by Filter: 10 + Rows Removed by Filter: 5 -> 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) - Rows Removed by Filter: 5040 + Rows Removed by Filter: 3360 -> 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 @@ -2195,21 +2193,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 25920 - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=5400 loops=1) + Rows Removed by Join Filter: 17280 + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 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=10 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=5040 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=12960) + -> Materialize (actual rows=2 loops=8640) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2223,19 +2221,19 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2592 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 8 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 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) @@ -2253,34 +2251,28 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=5184 loops=1) + Hash Semi Join (actual rows=3456 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=2592 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=2) + Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(27 rows) + -> Hash (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Buckets: 1024 Batches: 1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) SET seq_page_cost = 100; -- loop/row counts of this query is different on windows so we run it without analyze @@ -2320,19 +2312,19 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2592 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 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=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) - Rows Removed by Filter: 8 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 4 + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 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) @@ -2349,34 +2341,28 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Nested Loop (actual rows=5184 loops=1) + Hash Semi Join (actual rows=3456 loops=1) Output: _hyper_1_1_chunk.device_id_peer - -> Unique (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Sort (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Sort Key: "*VALUES*".column1 - Sort Method: quicksort - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 - -> Append (actual rows=2592 loops=2) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1080 loops=2) + Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=2 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=1008 loops=2) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) - Rows Removed by Filter: 4032 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=504 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=1 loops=2) + -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) -(27 rows) + -> Hash (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Buckets: 1024 Batches: 1 + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 +(21 rows) -- test view CREATE OR REPLACE VIEW compressed_view AS @@ -2399,7 +2385,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -2431,8 +2417,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2443,15 +2429,15 @@ FROM :TEST_TABLE m1 -> 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: 971 - -> 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=2 loops=10) + Rows Removed by Filter: 647 + -> 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 + Rows Removed by Filter: 336 -> 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) @@ -2477,8 +2463,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2489,15 +2475,15 @@ FROM :TEST_TABLE m1 -> 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: 971 - -> 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=2 loops=10) + Rows Removed by Filter: 647 + -> 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 + Rows Removed by Filter: 336 -> 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) -> Materialize (actual rows=10 loops=1) @@ -2506,17 +2492,17 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_2 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 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: 8 + 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 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=336 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 @@ -2543,10 +2529,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2560,10 +2546,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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: 8 + Rows Removed by Filter: 4 -> 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) @@ -2594,10 +2580,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -2611,10 +2597,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -2633,20 +2619,20 @@ FROM :TEST_TABLE m1 ORDER BY m1.time, m1.device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 39 + Rows Removed by Join Filter: 38 -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Sort (actual rows=10 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2654,14 +2640,14 @@ LIMIT 10; 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=49 loops=1) + -> Materialize (actual rows=48 loops=1) -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=11 loops=1) Order: m2."time" -> Sort (actual rows=11 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2696,8 +2682,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2711,10 +2697,10 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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: 8 + Rows Removed by Filter: 4 -> 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) @@ -2751,8 +2737,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2771,21 +2757,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2821,8 +2807,8 @@ ORDER BY m1.time, m2.time, m2.device_id LIMIT 20; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=20 loops=1) -> Incremental Sort (actual rows=20 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2835,8 +2821,8 @@ LIMIT 20; -> Sort (actual rows=5 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2850,8 +2836,8 @@ LIMIT 20; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2872,8 +2858,8 @@ ORDER BY m1.time, m1.device_id, m2.device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Incremental Sort (actual rows=10 loops=1) Sort Key: m1."time", m1.device_id, m2.device_id @@ -2886,8 +2872,8 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -2901,8 +2887,8 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk compress_hyper_5_15_chunk_1 (actual rows=5 loops=1) -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) -> Sort (never executed) Sort Key: m2_3."time" @@ -2927,7 +2913,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> 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")) -> Index Only Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) @@ -2935,7 +2921,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 160 -> 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")) (18 rows) @@ -2960,7 +2946,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> 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 _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) @@ -2968,7 +2954,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': 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 + Rows Removed by Filter: 160 -> 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) @@ -2983,17 +2969,17 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> 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: 2 + Rows Removed by Filter: 1 -> 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) Rows Removed by Filter: 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 + Rows Removed by Filter: 160 -> 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 @@ -3155,37 +3141,37 @@ 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=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 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=1008 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=3024 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=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=672 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=2016 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=672 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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=12960) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=12960) + -> 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=336 loops=1) + -> Append (actual rows=0 loops=8640) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=8640) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1080 - -> 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=12960) + Rows Removed by Filter: 720 + -> 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=8640) 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=12960) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=8640) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=12960) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=8640) 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_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=12960) + Rows Removed by Filter: 336 + -> 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=8640) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -3220,10 +3206,10 @@ LIMIT 5; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (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 (never executed) @@ -3246,22 +3232,22 @@ SELECT * FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=2592 loops=1) + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- + Custom Scan (ChunkAppend) on metrics_space (actual rows=1728 loops=1) Order: metrics_space."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) (16 rows) @@ -3290,16 +3276,16 @@ LIMIT 1000; -> Sort (actual rows=501 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=500 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -3330,21 +3316,21 @@ SELECT FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) (15 rows) -- test empty resultset @@ -3358,15 +3344,15 @@ WHERE device_id < 0; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id < 0) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) Index Cond: (device_id < 0) -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) @@ -3391,22 +3377,22 @@ SELECT 1 FROM :TEST_TABLE; QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=12960 loops=1) - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + Result (actual rows=8640 loops=1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) (16 rows) -- test constraints not present in targetlist @@ -3421,21 +3407,21 @@ LIMIT 1000; Limit (actual rows=1000 loops=1) -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=1000 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) + -> Sort (actual rows=280 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) (20 rows) @@ -3452,21 +3438,21 @@ LIMIT 1000; Limit (actual rows=1000 loops=1) -> Merge Append (actual rows=1000 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=1000 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_7_chunk.v1 Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) + -> Sort (actual rows=280 loops=1) Sort Key: _hyper_2_10_chunk.v1 Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) (20 rows) @@ -3477,14 +3463,14 @@ SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 LIMIT 1000; - QUERY PLAN ------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------- Limit (actual rows=1000 loops=1) -> Append (actual rows=1000 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1000 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (never executed) + -> Seq Scan on _hyper_2_7_chunk (actual rows=280 loops=1) Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) -> Seq Scan on compress_hyper_6_20_chunk (never executed) @@ -3517,10 +3503,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1080 - Batches Removed by Filter: 2 + Rows Removed by Filter: 720 + Batches Removed by Filter: 1 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 -> Sort (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 @@ -3529,10 +3515,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3240 - Batches Removed by Filter: 6 + Rows Removed by Filter: 2160 + Batches Removed by Filter: 3 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 -> Sort (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 @@ -3541,10 +3527,10 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1080 - Batches Removed by Filter: 2 + Rows Removed by Filter: 720 + Batches Removed by Filter: 1 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3555,7 +3541,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id @@ -3563,7 +3549,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id @@ -3571,7 +3557,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3581,7 +3567,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 Batches Removed by Filter: 1 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) @@ -3593,7 +3579,7 @@ ORDER BY time, -> 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 Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 1008 Batches Removed by Filter: 3 Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) @@ -3605,7 +3591,7 @@ ORDER BY time, -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 (103 rows) -- device_id constraint should be pushed down @@ -3624,8 +3610,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3654,20 +3640,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id IS NOT NULL) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -3721,21 +3707,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id IS NULL) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3794,16 +3780,16 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (actual rows=5 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -3844,8 +3830,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) @@ -3877,21 +3863,21 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3899,19 +3885,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3933,7 +3919,7 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (device_id = device_id_peer) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 (68 rows) :PREFIX @@ -3953,20 +3939,20 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (device_id_peer < device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4016,8 +4002,8 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (never executed) Filter: (device_id = 3) @@ -4034,8 +4020,8 @@ WHERE device_id = length(substring(version(), 1, 3)) ORDER BY time, device_id LIMIT 10; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time" @@ -4046,21 +4032,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 1080 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - Rows Removed by Filter: 3240 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 2160 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Filter: (device_id = length("substring"(version(), 1, 3))) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (never executed) @@ -4081,8 +4067,8 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) Filter: (device_id = length("substring"(version(), 1, 3))) -> Seq Scan on compress_hyper_6_21_chunk (never executed) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (never executed) - Index Cond: (device_id = length("substring"(version(), 1, 3))) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (never executed) + Filter: (device_id = length("substring"(version(), 1, 3))) (47 rows) -- @@ -4103,32 +4089,29 @@ LIMIT 10; Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 999 + Rows Removed by Filter: 719 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_17_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 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)) - Rows Removed by Filter: 1 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2997 + Rows Removed by Filter: 2157 -> Sort (actual rows=3 loops=1) Sort Key: compress_hyper_6_18_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 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)) - Rows Removed by Filter: 3 -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1 loops=1) Vectorized Filter: ("time" = 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 999 + Rows Removed by Filter: 719 -> Sort (actual rows=1 loops=1) Sort Key: compress_hyper_6_19_chunk.device_id Sort Method: quicksort -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 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)) - Rows Removed by Filter: 1 -(30 rows) +(27 rows) :PREFIX SELECT * @@ -4147,31 +4130,28 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=6 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 991 + Rows Removed by Filter: 714 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=27 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=18 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2973 + Rows Removed by Filter: 2142 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=9 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=6 loops=1) Vectorized Filter: ("time" < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 991 + Rows Removed by Filter: 714 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 < 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -(32 rows) +(29 rows) :PREFIX SELECT * @@ -4190,31 +4170,28 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=7 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 990 + Rows Removed by Filter: 713 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=21 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 2970 + Rows Removed by Filter: 2139 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 3 -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=7 loops=1) Vectorized Filter: ("time" <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 990 + Rows Removed by Filter: 713 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_min_3 <= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 1 -(32 rows) +(29 rows) :PREFIX SELECT * @@ -4233,26 +4210,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1071 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=714 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 9 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 6 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3213 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2142 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 27 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 18 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1071 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=714 loops=1) Vectorized Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 9 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 6 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4305,26 +4282,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 10 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3210 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 30 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 21 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 10 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4377,26 +4354,26 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 10 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3210 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 30 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 21 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Vectorized Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 10 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4440,8 +4417,8 @@ WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4454,7 +4431,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4462,7 +4439,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4470,7 +4447,7 @@ LIMIT 10; Vectorized Filter: (v0 < 1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4509,9 +4486,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v0 < 1) + Rows Removed by Filter: 336 +(70 rows) :PREFIX SELECT * @@ -4534,7 +4512,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -4542,7 +4520,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -4550,7 +4528,7 @@ LIMIT 10; Filter: (v0 < device_id) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_min_1 < device_id) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4558,19 +4536,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4594,7 +4572,7 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v0 < device_id) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 (73 rows) :PREFIX @@ -4614,23 +4592,23 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Filter: (device_id < v0) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_1 > device_id) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id @@ -4685,22 +4663,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1080 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 3240 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 2160 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1080 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4708,19 +4686,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4728,21 +4706,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 1008 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 (68 rows) --pushdown between two order by column (not pushed down) @@ -4765,22 +4743,22 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1080 - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 3240 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 2160 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1080 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 720 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4788,19 +4766,19 @@ LIMIT 10; Sort Method: quicksort -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 3024 + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1008 + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4808,21 +4786,21 @@ LIMIT 10; Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 1512 + Rows Removed by Filter: 1008 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 (68 rows) --pushdown of quals on order by and segment by cols anded together @@ -4847,12 +4825,12 @@ LIMIT 10; 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=713 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 Vectorized Filter: (_hyper_2_4_chunk."time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) - Rows Removed by Filter: 10 + Rows Removed by Filter: 7 Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: ((compress_hyper_6_17_chunk._ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) AND (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 (never executed) @@ -4887,26 +4865,26 @@ LIMIT 10; Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=10 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=10 loops=1) + -> Sort (actual rows=9 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=1 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3210 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2139 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 30 - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + Rows Removed by Filter: 21 + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1070 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=713 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) - Rows Removed by Filter: 10 - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + Rows Removed by Filter: 7 + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -4957,21 +4935,21 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) Vectorized Filter: ("time" < now()) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -5022,12 +5000,12 @@ LIMIT 10; -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC @@ -5075,12 +5053,12 @@ LIMIT 10; -> Sort (actual rows=7 loops=1) Sort Key: _hyper_2_11_chunk."time" DESC, _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC, _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: _hyper_2_9_chunk."time" DESC @@ -5118,18 +5096,18 @@ LIMIT 10; -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_4_chunk.device_id, _hyper_2_4_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_5_chunk.device_id, _hyper_2_5_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk.device_id, _hyper_2_6_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk (actual rows=1 loops=1) Heap Fetches: 0 -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1 loops=1) @@ -5139,12 +5117,12 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk.device_id, _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_11_chunk.device_id, _hyper_2_11_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Index Only Scan using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk (actual rows=1 loops=1) Heap Fetches: 0 @@ -5162,66 +5140,66 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=5875 loops=1) + Custom Scan (ChunkAppend) on public.metrics_space (actual rows=3915 loops=1) Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 Order: metrics_space."time", metrics_space.device_id Startup Exclusion: false Runtime Exclusion: false - -> Merge Append (actual rows=3355 loops=1) + -> Merge Append (actual rows=2235 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Sort (actual rows=2013 loops=1) + Rows Removed by Filter: 225 + -> Sort (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Sort (actual rows=671 loops=1) + Rows Removed by Filter: 675 + -> Sort (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Merge Append (actual rows=2520 loops=1) + Rows Removed by Filter: 225 + -> Merge Append (actual rows=1680 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 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 Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=1008 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 Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (62 rows) @@ -5238,32 +5216,32 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 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_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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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_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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) + -> 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=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (28 rows) @@ -5395,35 +5373,35 @@ ORDER BY device_id, v0; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) 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_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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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_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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) + -> 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=336 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5444,35 +5422,35 @@ ORDER BY device_id, v1 DESC; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC - -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) 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_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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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_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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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) + -> 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=336 loops=1) Output: _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 @@ -5491,38 +5469,38 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=5875 loops=1) + Sort (actual rows=3915 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time", _hyper_2_7_chunk.v3 Sort Method: quicksort - -> Append (actual rows=5875 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5540,18 +5518,18 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=5875 loops=1) + Merge Append (actual rows=3915 loops=1) Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=671 loops=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=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true @@ -5562,7 +5540,7 @@ ORDER BY device_id DESC, -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 @@ -5573,7 +5551,7 @@ ORDER BY device_id DESC, -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=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=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (36 rows) @@ -5590,38 +5568,38 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=5875 loops=1) + Sort (actual rows=3915 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk."time" Sort Method: quicksort - -> Append (actual rows=5875 loops=1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=671 loops=1) + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2013 loops=1) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=671 loops=1) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) @@ -5639,48 +5617,48 @@ ORDER BY time, device_id; QUERY PLAN --------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=5875 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=3915 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=3355 loops=1) + -> Merge Append (actual rows=2235 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=671 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=447 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Sort (actual rows=2013 loops=1) + Rows Removed by Filter: 225 + -> Sort (actual rows=1341 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2013 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=1341 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 1011 - -> Sort (actual rows=671 loops=1) + Rows Removed by Filter: 675 + -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=671 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=447 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 337 - -> Merge Append (actual rows=2520 loops=1) + Rows Removed by Filter: 225 + -> Merge Append (actual rows=1680 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (43 rows) @@ -5694,7 +5672,7 @@ ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Custom Scan (ChunkAppend) on metrics_space (actual rows=5875 loops=1) + Custom Scan (ChunkAppend) on metrics_space (actual rows=3915 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id @@ -5705,7 +5683,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: quicksort @@ -5713,7 +5691,7 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: quicksort @@ -5721,44 +5699,44 @@ ORDER BY time, Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - Rows Removed by Filter: 2 - -> Merge Append (actual rows=3355 loops=1) + Rows Removed by Filter: 1 + -> Merge Append (actual rows=2235 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=671 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=447 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=2013 loops=1) + -> Sort (actual rows=1341 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2013 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1341 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=671 loops=1) + -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=671 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=447 loops=1) Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) - -> Merge Append (actual rows=2520 loops=1) + -> Merge Append (actual rows=1680 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) Vectorized Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) Filter: (_ts_meta_max_3 > ('2000-01-08'::cstring)::timestamp with time zone) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) (66 rows) @@ -5771,28 +5749,28 @@ FROM :TEST_TABLE; Finalize Aggregate (actual rows=1 loops=1) -> Append (actual rows=9 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) (25 rows) -- test aggregate with GROUP BY @@ -5813,48 +5791,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=672 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=672 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) (50 rows) -- test window functions with GROUP BY @@ -5874,48 +5852,48 @@ ORDER BY device_id; -> Append (actual rows=15 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=672 loops=1) Sort Key: _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=3024 loops=1) + -> Sort (actual rows=2016 loops=1) Sort Key: _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=1008 loops=1) + -> Sort (actual rows=672 loops=1) Sort Key: _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) (51 rows) SET enable_hashagg = ON; @@ -5930,47 +5908,47 @@ FROM q ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- - Sort (actual rows=12960 loops=1) + Sort (actual rows=8640 loops=1) Sort Key: q.v1 Sort Method: quicksort - -> Subquery Scan on q (actual rows=12960 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=12960 loops=1) + -> Subquery Scan on q (actual rows=8640 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=8640 loops=1) Order: metrics_space."time" - -> Merge Append (actual rows=5400 loops=1) + -> Merge Append (actual rows=3600 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Sort (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2160 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Sort (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_6_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Merge Append (actual rows=5040 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Merge Append (actual rows=3360 loops=1) Sort Key: _hyper_2_7_chunk."time" - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=3024 loops=1) - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=1008 loops=1) - -> Merge Append (actual rows=2520 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Merge Append (actual rows=1680 loops=1) Sort Key: _hyper_2_10_chunk."time" - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Sort (actual rows=1512 loops=1) + -> Sort (actual rows=1008 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk (actual rows=336 loops=1) (41 rows) -- test CTE join @@ -5992,42 +5970,42 @@ SELECT * FROM q1 INNER JOIN q2 ON q1.time = q2.time ORDER BY q1.time; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------- - Merge Join (actual rows=2592 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- + Merge Join (actual rows=1728 loops=1) Merge Cond: (metrics_space."time" = metrics_space_1."time") - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=2592 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=1728 loops=1) Order: metrics_space."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Materialize (actual rows=2592 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=2592 loops=1) + -> Materialize (actual rows=1728 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space metrics_space_1 (actual rows=1728 loops=1) Order: metrics_space_1."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_5_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=1008 loops=1) + Rows Removed by Filter: 2 + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk (actual rows=672 loops=1) Index Cond: (device_id = 2) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_11_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2 @@ -6044,14 +6022,14 @@ WHERE device_id = 1; 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_2_4_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) (13 rows) @@ -6059,37 +6037,37 @@ WHERE device_id = 1; EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) EXECUTE prep; count ------- - 2592 + 1728 (1 row) DEALLOCATE prep; @@ -6107,27 +6085,27 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2592 loops=1) + Merge Append (actual rows=1728 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Output: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) @@ -6144,26 +6122,26 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2592 loops=1) + Merge Append (actual rows=1728 loops=1) Sort Key: _hyper_2_4_chunk."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 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 Sort Key: _hyper_2_4_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=1008 loops=1) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Filter: (_hyper_2_7_chunk.device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 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 Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) @@ -6180,26 +6158,26 @@ ORDER BY device_id, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=2592 loops=1) + Merge Append (actual rows=1728 loops=1) Sort Key: test_table_1."time" - -> Sort (actual rows=1080 loops=1) + -> Sort (actual rows=720 loops=1) Output: ((test_table_1.*)::metrics_space), test_table_1.device_id, test_table_1."time" Sort Key: test_table_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk test_table_1 (actual rows=720 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 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=1008 loops=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=672 loops=1) Output: test_table_2.*, test_table_2.device_id, test_table_2."time" Filter: (test_table_2.device_id = 1) - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Output: ((test_table_3.*)::metrics_space), test_table_3.device_id, test_table_3."time" Sort Key: test_table_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk test_table_3 (actual rows=336 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_device_id_device_id_peer__ts_meta_idx on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) @@ -6215,18 +6193,18 @@ WHERE device_id = 1 ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2592 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=1008 loops=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=672 loops=1) Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false -> 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) @@ -6245,19 +6223,19 @@ WHERE device_id = 1; -> Append (actual rows=3 loops=1) -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 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=1008 loops=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=672 loops=1) Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 -> Partial Aggregate (actual rows=1 loops=1) Output: PARTIAL count(*) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 @@ -6272,43 +6250,43 @@ FROM :TEST_TABLE ORDER BY device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=12960 loops=1) + Merge Append (actual rows=8640 loops=1) Sort Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id Bulk Decompression: false - -> 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=2 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id Bulk Decompression: false - -> 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=6 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=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id Bulk Decompression: false - -> 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=2 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=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=2016 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=672 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 loops=1) Output: _hyper_2_11_chunk.device_id Bulk Decompression: false -> 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._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Index Only Scan using _hyper_2_12_chunk_tmp_idx on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk.device_id Heap Fetches: 0 (39 rows) @@ -6445,21 +6423,21 @@ WHERE device_id_peer IN ( -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=0 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id_peer = 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=0 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 Filter: (compress_hyper_6_18_chunk.device_id_peer = 1) - Rows Removed by Filter: 6 + Rows Removed by Filter: 3 -> 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=0 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 Filter: (compress_hyper_6_19_chunk.device_id_peer = 1) - Rows Removed by Filter: 2 + Rows Removed by Filter: 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) Output: _hyper_2_7_chunk.device_id_peer Index Cond: (_hyper_2_7_chunk.device_id_peer = 1) @@ -6486,10 +6464,10 @@ WHERE device_id_peer IN ( Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 Filter: (compress_hyper_6_21_chunk.device_id_peer = 1) Rows Removed by Filter: 3 - -> 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) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk.device_id_peer - Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) - Heap Fetches: 0 + Filter: (_hyper_2_12_chunk.device_id_peer = 1) + Rows Removed by Filter: 336 (52 rows) --with multiple values can get a nested loop. @@ -6504,42 +6482,42 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_2_4_chunk.device_id_peer Join Filter: (_hyper_2_4_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 25920 - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + Rows Removed by Join Filter: 17280 + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2016 loops=1) Output: _hyper_2_8_chunk.device_id_peer - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=672 loops=1) Output: _hyper_2_9_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 loops=1) Output: _hyper_2_11_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk.device_id_peer - -> Materialize (actual rows=2 loops=12960) + -> Materialize (actual rows=2 loops=8640) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6553,17 +6531,17 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2592 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) @@ -6580,42 +6558,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=5184 loops=1) + Hash Semi Join (actual rows=3456 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2016 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=672 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6680,17 +6658,17 @@ WHERE device_id IN ( VALUES (1)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2592 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Filter: (compress_hyper_6_17_chunk.device_id = 1) - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id_peer Filter: (_hyper_2_7_chunk.device_id = 1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id_peer Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) @@ -6706,42 +6684,42 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=5184 loops=1) + Hash Semi Join (actual rows=3456 loops=1) Output: _hyper_2_4_chunk.device_id_peer Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=1080 loops=1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=3240 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_5_chunk (actual rows=2160 loops=1) Output: _hyper_2_5_chunk.device_id_peer, _hyper_2_5_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=1080 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_6_chunk (actual rows=720 loops=1) Output: _hyper_2_6_chunk.device_id_peer, _hyper_2_6_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=3024 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=2016 loops=1) Output: _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.device_id - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=1008 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=672 loops=1) Output: _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id_peer, _hyper_2_10_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 loops=1) Output: _hyper_2_11_chunk.device_id_peer, _hyper_2_11_chunk.device_id Bulk Decompression: false -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.device_id -> Hash (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -6771,7 +6749,7 @@ LIMIT 10; -> Sort (actual rows=10 loops=1) Sort Key: _hyper_2_10_chunk."time" DESC Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (never executed) @@ -6805,18 +6783,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -6849,18 +6827,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6911,18 +6889,18 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time", m2_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m2_2."time", m2_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time", m2_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) @@ -6950,35 +6928,35 @@ FROM :TEST_TABLE m1 -> Materialize (actual rows=49 loops=1) -> Nested Loop (actual rows=11 loops=1) Join Filter: (m1_1."time" = m3_1."time") - Rows Removed by Join Filter: 25912 + Rows Removed by Join Filter: 17272 -> 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 - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m3_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_2 (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk m3_2 (actual rows=1 loops=1) Filter: (device_id = 3) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m3_3 (actual rows=1 loops=1) Filter: (device_id = 3) - -> Materialize (actual rows=8641 loops=3) - -> Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) - -> Seq Scan on _hyper_2_7_chunk m1_4 (actual rows=1008 loops=1) - -> Seq Scan on _hyper_2_8_chunk m1_5 (actual rows=3024 loops=1) - -> Seq Scan on _hyper_2_9_chunk m1_6 (actual rows=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=504 loops=1) + -> Materialize (actual rows=5761 loops=3) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_2_7_chunk m1_4 (actual rows=672 loops=1) + -> Seq Scan on _hyper_2_8_chunk m1_5 (actual rows=2016 loops=1) + -> Seq Scan on _hyper_2_9_chunk m1_6 (actual rows=672 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1512 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=504 loops=1) + -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=336 loops=1) (80 rows) :PREFIX @@ -7002,8 +6980,8 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_2 (never executed) Filter: (device_id = 1) @@ -7018,10 +6996,10 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7052,10 +7030,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m1_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -7069,10 +7047,10 @@ FROM metrics m1 -> Sort (actual rows=100 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m2_2 (never executed) Index Cond: (device_id = 2) -> Sort (never executed) @@ -7097,7 +7075,7 @@ LIMIT 10; -> Merge Left Join (actual rows=10 loops=1) Merge Cond: (m1."time" = m2."time") Join Filter: (m1.device_id = m2.device_id) - Rows Removed by Join Filter: 40 + Rows Removed by Join Filter: 39 -> Custom Scan (ChunkAppend) on metrics_space m1 (actual rows=10 loops=1) Order: m1."time", m1.device_id -> Merge Append (actual rows=10 loops=1) @@ -7105,18 +7083,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=6 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) @@ -7141,7 +7119,7 @@ LIMIT 10; -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) - -> Materialize (actual rows=50 loops=1) + -> Materialize (actual rows=49 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" -> Merge Append (actual rows=11 loops=1) @@ -7149,18 +7127,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7208,18 +7186,18 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=61 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=21 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7247,21 +7225,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7313,8 +7291,8 @@ LIMIT 100; -> Sort (actual rows=101 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) -> Sort (never executed) Sort Key: m1_2."time", m1_2.device_id -> Seq Scan on _hyper_1_2_chunk m1_2 (never executed) @@ -7333,21 +7311,21 @@ LIMIT 100; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 4 + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) Filter: (device_id = 2) - Rows Removed by Filter: 2 + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7399,18 +7377,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7435,18 +7413,18 @@ LIMIT 20; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7494,18 +7472,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m1_1."time", m1_1.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m1_2."time", m1_2.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m1_3."time", m1_3.device_id Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m1_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m1_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m1_4 (never executed) @@ -7530,18 +7508,18 @@ LIMIT 10; -> Sort (actual rows=2 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=4 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=3240 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=6 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=2 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7577,7 +7555,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 7 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_2 (never executed) @@ -7599,7 +7577,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_7 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 160 -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time")) -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (never executed) @@ -7631,7 +7609,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_17_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 Only Scan using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m1_2 (actual rows=1 loops=7) @@ -7639,7 +7617,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 160 -> Seq Scan on compress_hyper_6_20_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) @@ -7654,7 +7632,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=5) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_time_idx on _hyper_2_8_chunk m1_2 (actual rows=1 loops=7) @@ -7662,7 +7640,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Heap Fetches: 0 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_3 (actual rows=1 loops=7) Filter: ("time" = g."time") - Rows Removed by Filter: 240 + Rows Removed by Filter: 160 -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=7) Filter: ((_ts_meta_min_3 <= g."time") AND (_ts_meta_max_3 >= g."time") AND (device_id = 2)) (18 rows) @@ -7823,37 +7801,37 @@ 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=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=1080 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=2 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=3240 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=6 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=1080 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=2 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=1008 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=3024 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=1008 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=504 loops=1) + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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=2160 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=720 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=672 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=2016 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=672 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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=12960) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=12960) + -> 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=336 loops=1) + -> Append (actual rows=0 loops=8640) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=0 loops=8640) Filter: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) - Rows Removed by Filter: 1080 - -> 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=12960) + Rows Removed by Filter: 720 + -> 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=8640) 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=12960) + -> Index Scan using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=0 loops=8640) Index Cond: (("time" > _hyper_2_4_chunk."time") AND ("time" < _hyper_2_4_chunk."time")) Filter: (_hyper_2_4_chunk.device_id = device_id) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=12960) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=0 loops=8640) 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_device_id_device_id_peer__ts_meta_idx on compress_hyper_5_16_chunk (actual rows=1 loops=12960) + Rows Removed by Filter: 336 + -> 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=8640) Index Cond: (device_id = _hyper_2_4_chunk.device_id) (30 rows) @@ -7943,30 +7921,30 @@ $$; (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=12960 loops=1) + -> Merge Append (actual rows=8640 loops=1) Sort Key: d_1.device_id - -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=5400 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=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk d_2 (actual rows=5040 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=10 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk d_3 (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk d_1 (actual rows=3600 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=3360 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=1680 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=12960) - -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=12960) + -> Limit (actual rows=0 loops=8640) + -> Custom Scan (ChunkAppend) on metrics_ordered m (actual rows=0 loops=8640) Order: m."time" DESC Hypertables excluded during runtime: 0 - -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=12960) - -> 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=12960) + -> Custom Scan (DecompressChunk) on _hyper_11_28_chunk m_1 (actual rows=0 loops=8640) + -> 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=8640) 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=12960) - -> 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=12960) + -> Custom Scan (DecompressChunk) on _hyper_11_27_chunk m_2 (actual rows=0 loops=8640) + -> 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=8640) 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=12960) - -> 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=12960) + -> Custom Scan (DecompressChunk) on _hyper_11_26_chunk m_3 (actual rows=0 loops=8640) + -> 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=8640) Index Cond: ((device_id = d_1.device_id) AND (device_id_peer = 3)) (23 rows) @@ -8037,10 +8015,10 @@ PREPARE tableoid_prep AS SELECT tableoid::regclass FROM :TEST_TABLE WHERE device -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_1_chunk."time" Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1080 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 8 + Rows Removed by Filter: 4 -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Sort (never executed) @@ -9537,14 +9515,14 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; QUERY PLAN ------------------------------------------------------------------------ Gather Merge - Workers Planned: 4 + Workers Planned: 3 -> Sort - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Parallel Seq Scan on _hyper_1_2_chunk (10 rows) @@ -9552,17 +9530,17 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v QUERY PLAN -------------------------------------------------------------------------------------- Finalize HashAggregate - Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time")) + Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather - Workers Planned: 4 + Workers Planned: 3 -> Partial HashAggregate - Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") -> Result -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Parallel Seq Scan on _hyper_1_2_chunk (13 rows) @@ -9580,10 +9558,10 @@ EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; -> Parallel Seq Scan on compress_hyper_6_19_chunk -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk -> Parallel Seq Scan on compress_hyper_6_20_chunk - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk - -> Parallel Seq Scan on compress_hyper_6_21_chunk -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk -> Parallel Seq Scan on compress_hyper_6_18_chunk + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk + -> Parallel Seq Scan on compress_hyper_6_21_chunk -> Parallel Seq Scan on _hyper_2_8_chunk -> Parallel Seq Scan on _hyper_2_7_chunk -> Parallel Seq Scan on _hyper_2_9_chunk @@ -9659,11 +9637,11 @@ $sql$; :PREFIX SELECT * FROM ht_func(); QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (6 rows) @@ -9672,11 +9650,11 @@ $sql$; :PREFIX SELECT * FROM ht_func(); QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=12960 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=5400 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=10 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=5040 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) + Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (6 rows) From f601114b9d304f12c00389a9589b1b3f604c7ba2 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 14:25:59 +0200 Subject: [PATCH 035/157] smaller limit --- .../expected/transparent_decompression-15.out | 117 +++++++++--------- .../transparent_decompression_query.sql | 8 +- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 30c9f83d271..3315471f5bc 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -277,16 +277,16 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 1000; +LIMIT 101; QUERY PLAN ------------------------------------------------------------------------------------------------------ - Limit (actual rows=1000 loops=1) - -> Result (actual rows=1000 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=1000 loops=1) + Limit (actual rows=101 loops=1) + -> Result (actual rows=101 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=101 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=1000 loops=1) + -> Sort (actual rows=101 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) @@ -358,28 +358,28 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 1000; +LIMIT 101; QUERY PLAN ----------------------------------------------------------------------------------------------- - Limit (actual rows=1000 loops=1) - -> Merge Append (actual rows=1000 loops=1) + Limit (actual rows=101 loops=1) + -> Merge Append (actual rows=101 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=101 loops=1) Sort Key: _hyper_1_1_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2688 - -> Sort (actual rows=280 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) @@ -392,28 +392,28 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 1000; +LIMIT 101; QUERY PLAN ----------------------------------------------------------------------------------------------- - Limit (actual rows=1000 loops=1) - -> Merge Append (actual rows=1000 loops=1) + Limit (actual rows=101 loops=1) + -> Merge Append (actual rows=101 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=101 loops=1) Sort Key: _hyper_1_1_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2688 - -> Sort (actual rows=280 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) @@ -425,21 +425,20 @@ LIMIT 1000; SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 1000; +LIMIT 101; QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=1000 loops=1) - -> Append (actual rows=1000 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + Limit (actual rows=101 loops=1) + -> Append (actual rows=101 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=101 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=280 loops=1) + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) -(11 rows) +(10 rows) -- -- test qual pushdown @@ -3264,24 +3263,24 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 1000; +LIMIT 101; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------- - Limit (actual rows=1000 loops=1) - -> Result (actual rows=1000 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=1000 loops=1) + Limit (actual rows=101 loops=1) + -> Result (actual rows=101 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=101 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=1000 loops=1) + -> Merge Append (actual rows=101 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=501 loops=1) + -> Sort (actual rows=51 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=500 loops=1) + -> Sort (actual rows=51 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) @@ -3401,26 +3400,26 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 1000; +LIMIT 101; QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=1000 loops=1) - -> Merge Append (actual rows=1000 loops=1) + Limit (actual rows=101 loops=1) + -> Merge Append (actual rows=101 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=101 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=280 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) @@ -3432,26 +3431,26 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 1000; +LIMIT 101; QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=1000 loops=1) - -> Merge Append (actual rows=1000 loops=1) + Limit (actual rows=101 loops=1) + -> Merge Append (actual rows=101 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) + -> Sort (actual rows=101 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=280 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) Filter: (device_id = 1) @@ -3462,15 +3461,15 @@ LIMIT 1000; SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 1000; +LIMIT 101; QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=1000 loops=1) - -> Append (actual rows=1000 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + Limit (actual rows=101 loops=1) + -> Append (actual rows=101 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=101 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=280 loops=1) + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) -> Seq Scan on compress_hyper_6_20_chunk (never executed) diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index fb5e1891a66..833e093c019 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -29,7 +29,7 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 1000; +LIMIT 101; -- test empty targetlist :PREFIX @@ -53,7 +53,7 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 1000; +LIMIT 101; -- test order not present in targetlist :PREFIX @@ -61,14 +61,14 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 1000; +LIMIT 101; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 1000; +LIMIT 101; -- -- test qual pushdown From 451b60fdddc788622188be876b910270dd0a5ff4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 14:37:08 +0200 Subject: [PATCH 036/157] limit 11 --- .../expected/transparent_decompression-15.out | 80 +++++++++---------- .../transparent_decompression_query.sql | 8 +- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 3315471f5bc..6ee3dc51311 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -277,14 +277,14 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 101; +LIMIT 11; QUERY PLAN ------------------------------------------------------------------------------------------------------ - Limit (actual rows=101 loops=1) - -> Result (actual rows=101 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=101 loops=1) + Limit (actual rows=11 loops=1) + -> Result (actual rows=11 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=11 loops=1) Order: metrics."time", metrics.device_id - -> Sort (actual rows=101 loops=1) + -> Sort (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 loops=1) @@ -358,13 +358,13 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 101; +LIMIT 11; QUERY PLAN ----------------------------------------------------------------------------------------------- - Limit (actual rows=101 loops=1) - -> Merge Append (actual rows=101 loops=1) + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=101 loops=1) + -> Sort (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) @@ -392,13 +392,13 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 101; +LIMIT 11; QUERY PLAN ----------------------------------------------------------------------------------------------- - Limit (actual rows=101 loops=1) - -> Merge Append (actual rows=101 loops=1) + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=101 loops=1) + -> Sort (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) @@ -425,12 +425,12 @@ LIMIT 101; SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 101; - QUERY PLAN ------------------------------------------------------------------------------------------ - Limit (actual rows=101 loops=1) - -> Append (actual rows=101 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=101 loops=1) +LIMIT 11; + QUERY PLAN +---------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Append (actual rows=11 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=11 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -3263,22 +3263,22 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 101; +LIMIT 11; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------- - Limit (actual rows=101 loops=1) - -> Result (actual rows=101 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=101 loops=1) + Limit (actual rows=11 loops=1) + -> Result (actual rows=11 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=11 loops=1) Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=101 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=51 loops=1) + -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=51 loops=1) + -> Sort (actual rows=6 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) @@ -3400,13 +3400,13 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 101; +LIMIT 11; QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=101 loops=1) - -> Merge Append (actual rows=101 loops=1) + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=101 loops=1) + -> Sort (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) @@ -3431,13 +3431,13 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 101; +LIMIT 11; QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=101 loops=1) - -> Merge Append (actual rows=101 loops=1) + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=101 loops=1) + -> Sort (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) @@ -3461,12 +3461,12 @@ LIMIT 101; SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 101; - QUERY PLAN ------------------------------------------------------------------------------------------ - Limit (actual rows=101 loops=1) - -> Append (actual rows=101 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=101 loops=1) +LIMIT 11; + QUERY PLAN +---------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Append (actual rows=11 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=11 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) -> Seq Scan on _hyper_2_7_chunk (never executed) diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 833e093c019..5d4a1a6cbc7 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -29,7 +29,7 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 101; +LIMIT 11; -- test empty targetlist :PREFIX @@ -53,7 +53,7 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 101; +LIMIT 11; -- test order not present in targetlist :PREFIX @@ -61,14 +61,14 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 101; +LIMIT 11; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 101; +LIMIT 11; -- -- test qual pushdown From c465b58768fc8a8650ccce2fcbf1056d796d222b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 15:15:17 +0200 Subject: [PATCH 037/157] work_mem 10MB --- tsl/test/expected/transparent_decompression-15.out | 2 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 6ee3dc51311..99765e00f45 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -7,7 +7,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED", format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '50MB'; +SET work_mem TO '10MB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; enable_memoize diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 78200a4fd9c..2face6f94c8 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -10,7 +10,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '50MB'; +SET work_mem TO '10MB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; From e8dfb2aa9d5c1806c939f58bf4cb2aa35fb57287 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 15:30:48 +0200 Subject: [PATCH 038/157] 1 MB --- tsl/test/expected/transparent_decompression-15.out | 2 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 99765e00f45..f8871cc6e3e 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -7,7 +7,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED", format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '10MB'; +SET work_mem TO '1MB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; enable_memoize diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 2face6f94c8..58a9c860c1c 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -10,7 +10,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '10MB'; +SET work_mem TO '1MB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; From e5a660b83c940e3dc282a254daab5e24efe78e6a Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 15:31:51 +0200 Subject: [PATCH 039/157] no limit --- tsl/test/sql/include/transparent_decompression_query.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 5d4a1a6cbc7..67efa0cb29f 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -29,7 +29,7 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 11; +; -- test empty targetlist :PREFIX @@ -53,7 +53,7 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; +; -- test order not present in targetlist :PREFIX @@ -61,14 +61,14 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; +; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; +; -- -- test qual pushdown From 6a75d468bfbce6fa3a9fdb2d7795bccf990f1cd2 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 11:42:40 +0200 Subject: [PATCH 040/157] no limit fixed --- .../expected/transparent_decompression-15.out | 393 +++++++++--------- 1 file changed, 202 insertions(+), 191 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index f8871cc6e3e..177f04831da 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -277,30 +277,33 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Result (actual rows=11 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=11 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 (never executed) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - -> Seq Scan on _hyper_1_2_chunk (never executed) +; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Result (actual rows=3456 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=3456 loops=1) + Order: metrics."time", metrics.device_id + -> Sort (actual rows=1440 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=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) - -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) -(20 rows) + Rows Removed by Filter: 3 + -> Sort (actual rows=1344 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=1344 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2016 + -> Sort (actual rows=672 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=672 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) -- test empty targetlist :PREFIX @@ -358,33 +361,32 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +----------------------------------------------------------------------------------------- + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + 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=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(23 rows) + Rows Removed by Filter: 4 + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(22 rows) -- test order not present in targetlist :PREFIX @@ -392,53 +394,54 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +----------------------------------------------------------------------------------------- + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + 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=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(23 rows) + Rows Removed by Filter: 4 + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(22 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; - QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Append (actual rows=11 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=11 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_1_2_chunk (never executed) +; + QUERY PLAN +----------------------------------------------------------------------------------- + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) - -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: (device_id = 1) -(10 rows) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 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) -- -- test qual pushdown @@ -1154,8 +1157,8 @@ WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id @@ -1166,6 +1169,7 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 28 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1175,7 +1179,8 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_5_16_chunk (never executed) -(19 rows) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) +(21 rows) --functions not yet optimized :PREFIX @@ -3263,51 +3268,55 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Result (actual rows=11 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=11 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- + Result (actual rows=3456 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=3456 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=1440 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (never executed) + -> Sort (actual rows=720 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 + -> Merge Append (actual rows=1344 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=672 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Merge Append (actual rows=672 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) -(41 rows) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 +(45 rows) -- test empty targetlist :PREFIX @@ -3400,30 +3409,29 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +------------------------------------------------------------------------------------------ + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) -(20 rows) + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(19 rows) -- test order not present in targetlist :PREFIX @@ -3431,50 +3439,48 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +------------------------------------------------------------------------------------------ + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) -(20 rows) + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(19 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; - QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Append (actual rows=11 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=11 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (never executed) +; + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 1) -(10 rows) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(9 rows) -- -- test qual pushdown @@ -4857,8 +4863,8 @@ WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4870,6 +4876,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=2 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort @@ -4877,6 +4884,7 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 21 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort @@ -4884,6 +4892,7 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -4905,16 +4914,18 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id -> Seq Scan on _hyper_2_12_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(55 rows) +(60 rows) --functions not yet optimized :PREFIX From e88d7a620cc263dfdafd9d00771e94cb5ba43558 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 12:03:09 +0200 Subject: [PATCH 041/157] Revert "no limit" This reverts commit e5a660b83c940e3dc282a254daab5e24efe78e6a. --- tsl/test/sql/include/transparent_decompression_query.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 67efa0cb29f..5d4a1a6cbc7 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -29,7 +29,7 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -; +LIMIT 11; -- test empty targetlist :PREFIX @@ -53,7 +53,7 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; +LIMIT 11; -- test order not present in targetlist :PREFIX @@ -61,14 +61,14 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; +LIMIT 11; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -; +LIMIT 11; -- -- test qual pushdown From 5ac83d894a242be100cfc5b0f75e41c3e0ca12c8 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 12:04:49 +0200 Subject: [PATCH 042/157] limit 11 again --- .../expected/transparent_decompression-15.out | 374 +++++++++--------- 1 file changed, 185 insertions(+), 189 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 177f04831da..2524a60da9f 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -277,33 +277,30 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Result (actual rows=3456 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=3456 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=1440 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=1440 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=1344 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=1344 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2016 - -> Sort (actual rows=672 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=672 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) +LIMIT 11; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=11 loops=1) + -> Result (actual rows=11 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=11 loops=1) + Order: metrics."time", metrics.device_id + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 (never executed) + Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(23 rows) + -> Sort (never executed) + Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) + -> Seq Scan on compress_hyper_5_16_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) +(20 rows) -- test empty targetlist :PREFIX @@ -361,32 +358,33 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +----------------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 - 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=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 -(22 rows) + Rows Removed by Filter: 2688 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(23 rows) -- test order not present in targetlist :PREFIX @@ -394,54 +392,53 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +----------------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 - 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=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 -(22 rows) + Rows Removed by Filter: 2688 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(23 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -; - QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=1728 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) +LIMIT 11; + QUERY PLAN +---------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Append (actual rows=11 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=11 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) - Rows Removed by Filter: 4 -(12 rows) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) + -> Seq Scan on compress_hyper_5_16_chunk (never executed) + Filter: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -3268,55 +3265,51 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- - Result (actual rows=3456 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=3456 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=1440 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Result (actual rows=11 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=11 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=720 loops=1) - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (actual rows=1344 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) + -> Sort (actual rows=6 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=6 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 + -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=672 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (actual rows=672 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + -> Sort (never executed) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 -(45 rows) + -> Sort (never executed) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Merge Append (never executed) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (never executed) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (never executed) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) +(41 rows) -- test empty targetlist :PREFIX @@ -3409,29 +3402,30 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(20 rows) -- test order not present in targetlist :PREFIX @@ -3439,48 +3433,50 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(20 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=1728 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) +LIMIT 11; + QUERY PLAN +---------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Append (actual rows=11 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=11 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) -(9 rows) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 1) +(10 rows) -- -- test qual pushdown From 6ff0bd1ee427e37e914e3c629bee025c570262bf Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 12:06:25 +0200 Subject: [PATCH 043/157] work_mem 64kB --- tsl/test/expected/transparent_decompression-15.out | 2 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 2524a60da9f..d27800ccdd2 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -7,7 +7,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED", format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '1MB'; +SET work_mem TO '64kB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; enable_memoize diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 58a9c860c1c..2131c4e3a21 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -10,7 +10,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '1MB'; +SET work_mem TO '64kB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; From 780ec7deee5cbbe9f4121dd7dc64ab648898bc10 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 12:15:35 +0200 Subject: [PATCH 044/157] Revert "limit 11 again" This reverts commit 5ac83d894a242be100cfc5b0f75e41c3e0ca12c8. --- .../expected/transparent_decompression-15.out | 374 +++++++++--------- 1 file changed, 189 insertions(+), 185 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index d27800ccdd2..4495f45864e 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -277,30 +277,33 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Result (actual rows=11 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=11 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 (never executed) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - -> Seq Scan on _hyper_1_2_chunk (never executed) +; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Result (actual rows=3456 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=3456 loops=1) + Order: metrics."time", metrics.device_id + -> Sort (actual rows=1440 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=1440 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=2 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) - -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) -(20 rows) + Rows Removed by Filter: 3 + -> Sort (actual rows=1344 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=1344 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2016 + -> Sort (actual rows=672 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=672 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) -- test empty targetlist :PREFIX @@ -358,33 +361,32 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +----------------------------------------------------------------------------------------- + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + 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=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(23 rows) + Rows Removed by Filter: 4 + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(22 rows) -- test order not present in targetlist :PREFIX @@ -392,53 +394,54 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +----------------------------------------------------------------------------------------- + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + 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=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(23 rows) + Rows Removed by Filter: 4 + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(22 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; - QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Append (actual rows=11 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=11 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_1_2_chunk (never executed) +; + QUERY PLAN +----------------------------------------------------------------------------------- + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) - -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: (device_id = 1) -(10 rows) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 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) -- -- test qual pushdown @@ -3265,51 +3268,55 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Result (actual rows=11 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=11 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- + Result (actual rows=3456 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=3456 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=1440 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (never executed) + -> Sort (actual rows=720 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 + -> Merge Append (actual rows=1344 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + Sort Method: quicksort + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=672 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Merge Append (actual rows=672 loops=1) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) -(41 rows) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 +(45 rows) -- test empty targetlist :PREFIX @@ -3402,30 +3409,29 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +------------------------------------------------------------------------------------------ + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) -(20 rows) + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(19 rows) -- test order not present in targetlist :PREFIX @@ -3433,50 +3439,48 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) +; + QUERY PLAN +------------------------------------------------------------------------------------------ + Merge Append (actual rows=1728 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + -> Sort (actual rows=720 loops=1) Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) -(20 rows) + -> Sort (actual rows=672 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: quicksort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=336 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(19 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; - QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Append (actual rows=11 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=11 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (never executed) +; + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 1) -(10 rows) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(9 rows) -- -- test qual pushdown From f53983a88089666ed8b6a31b6968dac986d1902e Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 12:18:40 +0200 Subject: [PATCH 045/157] no limit again --- tsl/test/sql/include/transparent_decompression_query.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 5d4a1a6cbc7..67efa0cb29f 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -29,7 +29,7 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -LIMIT 11; +; -- test empty targetlist :PREFIX @@ -53,7 +53,7 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; +; -- test order not present in targetlist :PREFIX @@ -61,14 +61,14 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; +; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; +; -- -- test qual pushdown From 7d05527b4c48f5b65c517c5275347144a4ea1f69 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 12:04:49 +0200 Subject: [PATCH 046/157] limit 11 again --- .../expected/transparent_decompression-15.out | 374 +++++++++--------- 1 file changed, 185 insertions(+), 189 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 4495f45864e..d27800ccdd2 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -277,33 +277,30 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Result (actual rows=3456 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=3456 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=1440 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=1440 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=1344 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=1344 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2016 - -> Sort (actual rows=672 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=672 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=2 loops=1) +LIMIT 11; + QUERY PLAN +------------------------------------------------------------------------------------------------------ + Limit (actual rows=11 loops=1) + -> Result (actual rows=11 loops=1) + -> Custom Scan (ChunkAppend) on metrics (actual rows=11 loops=1) + Order: metrics."time", metrics.device_id + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 (never executed) + Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(23 rows) + -> Sort (never executed) + Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) + -> Seq Scan on compress_hyper_5_16_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) +(20 rows) -- test empty targetlist :PREFIX @@ -361,32 +358,33 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +----------------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 - 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=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 -(22 rows) + Rows Removed by Filter: 2688 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(23 rows) -- test order not present in targetlist :PREFIX @@ -394,54 +392,53 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------ - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +----------------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_1_1_chunk.v1 - 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=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_2_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 4 -(22 rows) + Rows Removed by Filter: 2688 + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_1_3_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 4 +(23 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -; - QUERY PLAN ------------------------------------------------------------------------------------ - Append (actual rows=1728 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) +LIMIT 11; + QUERY PLAN +---------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Append (actual rows=11 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=11 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_1_2_chunk (never executed) Filter: (device_id = 1) - Rows Removed by Filter: 4 -(12 rows) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) + -> Seq Scan on compress_hyper_5_16_chunk (never executed) + Filter: (device_id = 1) +(10 rows) -- -- test qual pushdown @@ -3268,55 +3265,51 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------- - Result (actual rows=3456 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=3456 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=1440 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Result (actual rows=11 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space (actual rows=11 loops=1) + Order: metrics_space."time", metrics_space.device_id + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=720 loops=1) - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (actual rows=1344 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) + -> Sort (actual rows=6 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=6 loops=1) + Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 + -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=672 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (actual rows=672 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + -> Sort (never executed) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 -(45 rows) + -> Sort (never executed) + Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Merge Append (never executed) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Sort (never executed) + Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (never executed) + Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) +(41 rows) -- test empty targetlist :PREFIX @@ -3409,29 +3402,30 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(20 rows) -- test order not present in targetlist :PREFIX @@ -3439,48 +3433,50 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; - QUERY PLAN ------------------------------------------------------------------------------------------- - Merge Append (actual rows=1728 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=720 loops=1) +LIMIT 11; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Limit (actual rows=11 loops=1) + -> Merge Append (actual rows=11 loops=1) Sort Key: _hyper_2_4_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + -> Sort (actual rows=11 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_7_chunk.v1 + Sort Method: top-N heapsort + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) Filter: (device_id = 1) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: _hyper_2_10_chunk.v1 + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(20 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=1728 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) +LIMIT 11; + QUERY PLAN +---------------------------------------------------------------------------------------- + Limit (actual rows=11 loops=1) + -> Append (actual rows=11 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=11 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_2_7_chunk (never executed) Filter: (device_id = 1) -(9 rows) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 1) +(10 rows) -- -- test qual pushdown From 0e789c4aa102a121801628e0cad616abf411ce2d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 13:10:27 +0200 Subject: [PATCH 047/157] Revert "no limit fixed" This reverts commit 6a75d468bfbce6fa3a9fdb2d7795bccf990f1cd2. --- .../expected/transparent_decompression-15.out | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index d27800ccdd2..fb24d0d9fa7 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1154,8 +1154,8 @@ WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id @@ -1166,7 +1166,6 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 28 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1176,8 +1175,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(21 rows) +(19 rows) --functions not yet optimized :PREFIX @@ -4859,8 +4857,8 @@ WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4872,7 +4870,6 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=2 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort @@ -4880,7 +4877,6 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 21 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort @@ -4888,7 +4884,6 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -4910,18 +4905,16 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id -> Seq Scan on _hyper_2_12_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(60 rows) +(55 rows) --functions not yet optimized :PREFIX From 65583c85eecd0d5bf320a98abc69d66436ec253d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 23 May 2024 14:37:08 +0200 Subject: [PATCH 048/157] limit 11 --- tsl/test/sql/include/transparent_decompression_query.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 67efa0cb29f..5d4a1a6cbc7 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -29,7 +29,7 @@ FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, device_id -; +LIMIT 11; -- test empty targetlist :PREFIX @@ -53,7 +53,7 @@ SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; +LIMIT 11; -- test order not present in targetlist :PREFIX @@ -61,14 +61,14 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -; +LIMIT 11; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -; +LIMIT 11; -- -- test qual pushdown From 0fa86fd5b3c9a9e3c86f1e53443ea192a7fedf48 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 13:17:53 +0200 Subject: [PATCH 049/157] ref --- .../expected/transparent_decompression-15.out | 412 ++++++++---------- .../transparent_decompression_query.sql | 38 +- tsl/test/sql/transparent_decompression.sql.in | 2 +- 3 files changed, 209 insertions(+), 243 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index fb24d0d9fa7..fbe1ee924f4 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -7,7 +7,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", format('%s/results/%s_results_uncompressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_UNCOMPRESSED", format('%s/results/%s_results_compressed.out', :'TEST_OUTPUT_DIR', :'TEST_BASE_NAME') AS "TEST_RESULTS_COMPRESSED" \gset SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '64kB'; +SET work_mem TO '50MB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; enable_memoize @@ -265,43 +265,6 @@ ORDER BY time; Rows Removed by Filter: 4 (19 rows) --- test expressions -:PREFIX -SELECT time_bucket ('1d', time), - v1 + v2 AS "sum", - COALESCE(NULL, v1, v2) AS "coalesce", - NULL AS "NULL", - 'text' AS "text", - :TEST_TABLE AS "RECORD" -FROM :TEST_TABLE -WHERE device_id IN (1, 2) -ORDER BY time, - device_id -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Result (actual rows=11 loops=1) - -> Custom Scan (ChunkAppend) on metrics (actual rows=11 loops=1) - Order: metrics."time", metrics.device_id - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 (never executed) - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - -> Seq Scan on _hyper_1_2_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) - -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) -(20 rows) - -- test empty targetlist :PREFIX SELECT @@ -352,39 +315,66 @@ FROM :TEST_TABLE; -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) (7 rows) +-- The following plans are flaky between MergeAppend or Sort + Append. +SET enable_sort = off; +-- test expressions +:PREFIX +SELECT time_bucket ('1d', time), + v1 + v2 AS "sum", + COALESCE(NULL, v1, v2) AS "coalesce", + NULL AS "NULL", + 'text' AS "text", + :TEST_TABLE AS "RECORD" +FROM :TEST_TABLE +WHERE device_id IN (1, 2) +ORDER BY time, + device_id +; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Sort (actual rows=3456 loops=1) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Method: quicksort + -> Result (actual rows=3456 loops=1) + -> Append (actual rows=3456 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 + -> Seq Scan on _hyper_1_2_chunk (actual rows=1344 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2016 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=672 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 +(16 rows) + -- test constraints not present in targetlist :PREFIX SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) +; + QUERY PLAN +----------------------------------------------------------------------------------------- + Sort (actual rows=1728 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: quicksort + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(23 rows) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 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) -- test order not present in targetlist :PREFIX @@ -392,54 +382,49 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_1_1_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_2_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) +; + QUERY PLAN +----------------------------------------------------------------------------------------- + Sort (actual rows=1728 loops=1) + Sort Key: _hyper_1_1_chunk.v1 + Sort Method: quicksort + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2688 - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_1_3_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - Rows Removed by Filter: 4 -(23 rows) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 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) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; - QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Append (actual rows=11 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=11 loops=1) - -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_1_2_chunk (never executed) +; + QUERY PLAN +----------------------------------------------------------------------------------- + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) - -> Seq Scan on compress_hyper_5_16_chunk (never executed) - Filter: (device_id = 1) -(10 rows) + Rows Removed by Filter: 4 + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 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) +RESET enable_sort; -- -- test qual pushdown -- @@ -1154,8 +1139,8 @@ WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics (actual rows=10 loops=1) Order: metrics."time", metrics.device_id @@ -1166,6 +1151,7 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 28 -> Seq Scan on compress_hyper_5_15_chunk (actual rows=5 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -1175,7 +1161,8 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_5_16_chunk (never executed) -(19 rows) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) +(21 rows) --functions not yet optimized :PREFIX @@ -3251,64 +3238,6 @@ ORDER BY time; Filter: (device_id = 1) (16 rows) --- test expressions -:PREFIX -SELECT time_bucket ('1d', time), - v1 + v2 AS "sum", - COALESCE(NULL, v1, v2) AS "coalesce", - NULL AS "NULL", - 'text' AS "text", - :TEST_TABLE AS "RECORD" -FROM :TEST_TABLE -WHERE device_id IN (1, 2) -ORDER BY time, - device_id -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ - Limit (actual rows=11 loops=1) - -> Result (actual rows=11 loops=1) - -> Custom Scan (ChunkAppend) on metrics_space (actual rows=11 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 2 - -> Merge Append (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) - -> Merge Append (never executed) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) - -> Sort (never executed) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) -(41 rows) - -- test empty targetlist :PREFIX SELECT @@ -3394,36 +3323,70 @@ FROM :TEST_TABLE; -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) (16 rows) --- test constraints not present in targetlist +-- The following plans are flaky between MergeAppend or Sort + Append. +SET enable_sort = off; +-- test expressions :PREFIX -SELECT v1 +SELECT time_bucket ('1d', time), + v1 + v2 AS "sum", + COALESCE(NULL, v1, v2) AS "coalesce", + NULL AS "NULL", + 'text' AS "text", + :TEST_TABLE AS "RECORD" FROM :TEST_TABLE -WHERE device_id = 1 -ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - Sort Method: top-N heapsort +WHERE device_id IN (1, 2) +ORDER BY time, + device_id +; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=3456 loops=1) + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> Result (actual rows=3456 loops=1) + -> Append (actual rows=3456 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: top-N heapsort + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: top-N heapsort + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=672 loops=1) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) -(20 rows) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=1 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + Rows Removed by Filter: 2 +(23 rows) + +-- test constraints not present in targetlist +:PREFIX +SELECT v1 +FROM :TEST_TABLE +WHERE device_id = 1 +ORDER BY v1 +; + QUERY PLAN +------------------------------------------------------------------------------------------ + Sort (actual rows=1728 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: quicksort + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(12 rows) -- test order not present in targetlist :PREFIX @@ -3431,51 +3394,43 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; - QUERY PLAN ------------------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Merge Append (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - -> Sort (actual rows=11 loops=1) - Sort Key: _hyper_2_4_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_7_chunk.v1 - Sort Method: top-N heapsort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) +; + QUERY PLAN +------------------------------------------------------------------------------------------ + Sort (actual rows=1728 loops=1) + Sort Key: _hyper_2_4_chunk.v1 + Sort Method: quicksort + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Sort (actual rows=1 loops=1) - Sort Key: _hyper_2_10_chunk.v1 - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) -(20 rows) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(12 rows) -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; - QUERY PLAN ----------------------------------------------------------------------------------------- - Limit (actual rows=11 loops=1) - -> Append (actual rows=11 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=11 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) - Filter: (device_id = 1) - -> Seq Scan on _hyper_2_7_chunk (never executed) +; + QUERY PLAN +------------------------------------------------------------------------------------ + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) Filter: (device_id = 1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 1) -(10 rows) + -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + Filter: (device_id = 1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + Filter: (device_id = 1) +(9 rows) +RESET enable_sort; -- -- test qual pushdown -- @@ -4857,8 +4812,8 @@ WHERE time > '2000-01-01 1:00:00+0' ORDER BY time, device_id LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4870,6 +4825,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_17_chunk (actual rows=1 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=2 loops=1) Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id Sort Method: top-N heapsort @@ -4877,6 +4833,7 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 21 -> Seq Scan on compress_hyper_6_18_chunk (actual rows=3 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id Sort Method: top-N heapsort @@ -4884,6 +4841,7 @@ LIMIT 10; Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) Rows Removed by Filter: 7 -> Seq Scan on compress_hyper_6_19_chunk (actual rows=1 loops=1) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) @@ -4905,16 +4863,18 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id -> Seq Scan on _hyper_2_12_chunk (never executed) Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(55 rows) +(60 rows) --functions not yet optimized :PREFIX diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 5d4a1a6cbc7..20502e69e2b 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -17,19 +17,6 @@ FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; --- test expressions -:PREFIX -SELECT time_bucket ('1d', time), - v1 + v2 AS "sum", - COALESCE(NULL, v1, v2) AS "coalesce", - NULL AS "NULL", - 'text' AS "text", - :TEST_TABLE AS "RECORD" -FROM :TEST_TABLE -WHERE device_id IN (1, 2) -ORDER BY time, - device_id -LIMIT 11; -- test empty targetlist :PREFIX @@ -47,13 +34,30 @@ WHERE device_id < 0; SELECT 1 FROM :TEST_TABLE; +-- The following plans are flaky between MergeAppend or Sort + Append. +SET enable_sort = off; + +-- test expressions +:PREFIX +SELECT time_bucket ('1d', time), + v1 + v2 AS "sum", + COALESCE(NULL, v1, v2) AS "coalesce", + NULL AS "NULL", + 'text' AS "text", + :TEST_TABLE AS "RECORD" +FROM :TEST_TABLE +WHERE device_id IN (1, 2) +ORDER BY time, + device_id +; + -- test constraints not present in targetlist :PREFIX SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; +; -- test order not present in targetlist :PREFIX @@ -61,14 +65,16 @@ SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 ORDER BY v1 -LIMIT 11; +; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE WHERE device_id = 1 -LIMIT 11; +; + +RESET enable_sort; -- -- test qual pushdown diff --git a/tsl/test/sql/transparent_decompression.sql.in b/tsl/test/sql/transparent_decompression.sql.in index 2131c4e3a21..78200a4fd9c 100644 --- a/tsl/test/sql/transparent_decompression.sql.in +++ b/tsl/test/sql/transparent_decompression.sql.in @@ -10,7 +10,7 @@ SELECT format('include/%s_load.sql', :'TEST_BASE_NAME') AS "TEST_LOAD_NAME", SELECT format('\! diff %s %s', :'TEST_RESULTS_UNCOMPRESSED', :'TEST_RESULTS_COMPRESSED') AS "DIFF_CMD" \gset -SET work_mem TO '64kB'; +SET work_mem TO '50MB'; -- disable memoize node to make EXPLAIN output comparable between PG14 and previous versions SELECT CASE WHEN current_setting('server_version_num')::int/10000 >= 14 THEN set_config('enable_memoize','off',false) ELSE 'off' END AS enable_memoize; From 211e3a5289eddba5e3554fb1e301039dca3d8eaf Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 29 May 2024 13:33:47 +0200 Subject: [PATCH 050/157] try something else --- src/nodes/chunk_append/planner.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index 2cef2e11e09..aa72d22df86 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -89,11 +89,17 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List &nullsFirst); /* inject sort node if child sort order does not match desired order */ -// if (!pathkeys_contained_in(pathkeys, path->pathkeys)) - if (!pathkeys_contained_in(pathkeys, path->pathkeys) && !IsA(plan, Sort)) + if (!pathkeys_contained_in(pathkeys, path->pathkeys)) +// if (!pathkeys_contained_in(pathkeys, path->pathkeys) && !IsA(plan, Sort)) { + Plan *child = plan; + if (IsA(plan, Sort)) + { + child = plan->lefttree; + } + plan = (Plan *) - make_sort(plan, childSortCols, childColIdx, sortOperators, collations, nullsFirst); + make_sort(child, childSortCols, childColIdx, sortOperators, collations, nullsFirst); } return plan; } From ad7c2695be20eea10af56dde080001bf98e26fc7 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 31 May 2024 14:07:26 +0200 Subject: [PATCH 051/157] disable sort in more places --- .../expected/transparent_decompression-15.out | 40 +++++++++---------- .../transparent_decompression_query.sql | 7 +++- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index fbe1ee924f4..2fdd7d367e7 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1476,7 +1476,9 @@ ORDER BY device_id, Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (17 rows) --- should not produce ordered path +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; +-- should not produce ordered path. :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE @@ -1489,20 +1491,15 @@ ORDER BY device_id, v3; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 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 Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - -> Sort (actual rows=2235 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 - Sort Key: _hyper_1_2_chunk.device_id, _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time", _hyper_1_2_chunk.v3 - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Rows Removed by Filter: 1125 - -> Sort (actual rows=1680 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.device_id, _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1 DESC, _hyper_1_3_chunk."time", _hyper_1_3_chunk.v3 - Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1510,7 +1507,7 @@ ORDER BY device_id, -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- should produce ordered path -- ASC/DESC for segmentby columns can be pushed down @@ -1560,20 +1557,15 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - -> Sort (actual rows=2235 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 - Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1, _hyper_1_2_chunk."time" - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Rows Removed by Filter: 1125 - -> Sort (actual rows=1680 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.device_id DESC, _hyper_1_3_chunk.device_id_peer DESC, _hyper_1_3_chunk.v0, _hyper_1_3_chunk.v1, _hyper_1_3_chunk."time" - Sort Method: quicksort -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) @@ -1581,8 +1573,9 @@ ORDER BY device_id DESC, -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) +RESET enable_sort; -- -- test constraint exclusion -- @@ -5415,7 +5408,9 @@ ORDER BY device_id, Heap Fetches: 0 (32 rows) --- should not produce ordered path +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; +-- should not produce ordered path. :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE @@ -5563,6 +5558,7 @@ ORDER BY device_id DESC, Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) +RESET enable_sort; -- -- test constraint exclusion -- diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 20502e69e2b..aae750869ea 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -392,7 +392,10 @@ ORDER BY device_id, v0, v1 DESC; --- should not produce ordered path +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; + +-- should not produce ordered path. :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE @@ -428,6 +431,8 @@ ORDER BY device_id DESC, v1, time; +RESET enable_sort; + -- -- test constraint exclusion -- From c48faf5f530316fba82e5fa5e5e4cb0bd1fa8edc Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 31 May 2024 16:31:24 +0200 Subject: [PATCH 052/157] disable sort in more test --- tsl/test/expected/transparent_decompression-15.out | 12 ++++++++++++ .../sql/include/transparent_decompression_query.sql | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 2fdd7d367e7..6d5b3606f87 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -476,6 +476,8 @@ ORDER BY time, Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 (37 rows) +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; -- device_id constraint should be pushed down :PREFIX SELECT * @@ -505,6 +507,7 @@ LIMIT 10; Filter: (device_id = 1) (17 rows) +RESET enable_sort; -- test IS NULL / IS NOT NULL :PREFIX SELECT * @@ -2071,6 +2074,8 @@ ORDER BY device_id; (15 rows) DROP INDEX tmp_idx CASCADE; +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; --use the peer index :PREFIX_VERBOSE SELECT * @@ -2103,6 +2108,7 @@ ORDER BY device_id_peer, Index Cond: (compress_hyper_5_16_chunk.device_id_peer = 1) (21 rows) +RESET enable_sort; :PREFIX_VERBOSE SELECT device_id_peer FROM :TEST_TABLE @@ -3541,6 +3547,8 @@ ORDER BY time, Rows Removed by Filter: 336 (103 rows) +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; -- device_id constraint should be pushed down :PREFIX SELECT * @@ -3569,6 +3577,7 @@ LIMIT 10; Filter: (device_id = 1) (16 rows) +RESET enable_sort; -- test IS NULL / IS NOT NULL :PREFIX SELECT * @@ -6247,6 +6256,8 @@ ORDER BY device_id; (39 rows) DROP INDEX tmp_idx CASCADE; +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; --use the peer index :PREFIX_VERBOSE SELECT * @@ -6305,6 +6316,7 @@ ORDER BY device_id_peer, Index Cond: (_hyper_2_12_chunk.device_id_peer = 1) (47 rows) +RESET enable_sort; :PREFIX_VERBOSE SELECT device_id_peer FROM :TEST_TABLE diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index aae750869ea..b7ed334e8d5 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -88,6 +88,9 @@ WHERE v3 > 10.0 ORDER BY time, device_id; +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; + -- device_id constraint should be pushed down :PREFIX SELECT * @@ -97,6 +100,8 @@ ORDER BY time, device_id LIMIT 10; +RESET enable_sort; + -- test IS NULL / IS NOT NULL :PREFIX SELECT * @@ -584,6 +589,9 @@ ORDER BY device_id; DROP INDEX tmp_idx CASCADE; +-- These plans are flaky between MergeAppend and Sort over Append. +SET enable_sort TO OFF; + --use the peer index :PREFIX_VERBOSE SELECT * @@ -592,6 +600,8 @@ WHERE device_id_peer = 1 ORDER BY device_id_peer, time; +RESET enable_sort; + :PREFIX_VERBOSE SELECT device_id_peer FROM :TEST_TABLE From b45a8d2ae89dd0a671fd8b2c833ecf9e0e37f652 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 3 Jun 2024 13:27:42 +0200 Subject: [PATCH 053/157] more cases --- .../expected/transparent_decompression-15.out | 260 +++++++----------- .../transparent_decompression_query.sql | 10 +- 2 files changed, 96 insertions(+), 174 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 6d5b3606f87..b2d33ba9820 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -424,7 +424,6 @@ WHERE device_id = 1 Rows Removed by Filter: 4 (12 rows) -RESET enable_sort; -- -- test qual pushdown -- @@ -437,15 +436,11 @@ ORDER BY time, device_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics (actual rows=0 loops=1) - Output: metrics."time", metrics.device_id, metrics.device_id_peer, metrics.v0, metrics.v1, metrics.v2, metrics.v3 - Order: metrics."time", metrics.device_id - Startup Exclusion: false - Runtime Exclusion: false - -> 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", _hyper_1_1_chunk.device_id - Sort Method: quicksort + 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", _hyper_1_1_chunk.device_id + Sort Method: quicksort + -> Append (actual rows=0 loops=1) -> 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 Vectorized Filter: (_hyper_1_1_chunk.v3 > '10'::double precision) @@ -454,18 +449,10 @@ ORDER BY time, Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Sort (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 - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device_id - Sort Method: quicksort -> Seq Scan 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.v3 > '10'::double precision) Rows Removed by Filter: 3360 - -> 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", _hyper_1_3_chunk.device_id - 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 Vectorized Filter: (_hyper_1_3_chunk.v3 > '10'::double precision) @@ -474,10 +461,8 @@ ORDER BY time, Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 -(37 rows) +(25 rows) --- These plans are flaky between MergeAppend and Sort over Append. -SET enable_sort TO OFF; -- device_id constraint should be pushed down :PREFIX SELECT * @@ -1584,6 +1569,8 @@ RESET enable_sort; -- -- test plan time exclusion -- first chunk should be excluded +-- This plan is flaky between MergeAppend and Sort over Append. +SET enable_sort TO off; :PREFIX SELECT * FROM :TEST_TABLE @@ -1609,6 +1596,7 @@ ORDER BY time, Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (15 rows) +RESET enable_sort; -- test runtime exclusion -- first chunk should be excluded :PREFIX @@ -3429,7 +3417,6 @@ WHERE device_id = 1 Filter: (device_id = 1) (9 rows) -RESET enable_sort; -- -- test qual pushdown -- @@ -3440,115 +3427,71 @@ FROM :TEST_TABLE WHERE v3 > 10.0 ORDER BY time, device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=0 loops=1) - Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 - Order: metrics_space."time", metrics_space.device_id - Startup Exclusion: false - Runtime Exclusion: false - -> Merge Append (actual rows=0 loops=1) - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - -> Sort (actual rows=0 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (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 + Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id + Sort Method: quicksort + -> Append (actual rows=0 loops=1) + -> 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 - Sort Key: _hyper_2_4_chunk."time", _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> 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 - Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 720 - Batches Removed by Filter: 1 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 - -> Sort (actual rows=0 loops=1) + Vectorized Filter: (_hyper_2_4_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 720 + Batches Removed by Filter: 1 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_17_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_17_chunk._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 + -> 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 - Sort Key: _hyper_2_5_chunk."time", _hyper_2_5_chunk.device_id - Sort Method: quicksort - -> 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 - Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2160 - Batches Removed by Filter: 3 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 - -> Sort (actual rows=0 loops=1) + Vectorized Filter: (_hyper_2_5_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 2160 + Batches Removed by Filter: 3 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_18_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_18_chunk._ts_meta_count, compress_hyper_6_18_chunk._ts_meta_sequence_num, compress_hyper_6_18_chunk.device_id, compress_hyper_6_18_chunk.device_id_peer, compress_hyper_6_18_chunk._ts_meta_min_3, compress_hyper_6_18_chunk._ts_meta_max_3, compress_hyper_6_18_chunk."time", compress_hyper_6_18_chunk._ts_meta_min_1, compress_hyper_6_18_chunk._ts_meta_max_1, compress_hyper_6_18_chunk.v0, compress_hyper_6_18_chunk._ts_meta_min_2, compress_hyper_6_18_chunk._ts_meta_max_2, compress_hyper_6_18_chunk.v1, compress_hyper_6_18_chunk.v2, compress_hyper_6_18_chunk.v3 + -> 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 - Sort Key: _hyper_2_6_chunk."time", _hyper_2_6_chunk.device_id - Sort Method: quicksort - -> 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 - Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 720 - Batches Removed by Filter: 1 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 - -> Merge Append (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=0 loops=1) + Vectorized Filter: (_hyper_2_6_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 720 + Batches Removed by Filter: 1 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_19_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_19_chunk._ts_meta_count, compress_hyper_6_19_chunk._ts_meta_sequence_num, compress_hyper_6_19_chunk.device_id, compress_hyper_6_19_chunk.device_id_peer, compress_hyper_6_19_chunk._ts_meta_min_3, compress_hyper_6_19_chunk._ts_meta_max_3, compress_hyper_6_19_chunk."time", compress_hyper_6_19_chunk._ts_meta_min_1, compress_hyper_6_19_chunk._ts_meta_max_1, compress_hyper_6_19_chunk.v0, compress_hyper_6_19_chunk._ts_meta_min_2, compress_hyper_6_19_chunk._ts_meta_max_2, compress_hyper_6_19_chunk.v1, compress_hyper_6_19_chunk.v2, compress_hyper_6_19_chunk.v3 + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=0 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 672 - -> Sort (actual rows=0 loops=1) + Filter: (_hyper_2_7_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 672 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=0 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 2016 - -> Sort (actual rows=0 loops=1) + Filter: (_hyper_2_8_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 2016 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=0 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 672 - -> Merge Append (actual rows=0 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=0 loops=1) + Filter: (_hyper_2_9_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 672 + -> 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 - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - Sort Method: quicksort - -> 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 - Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 336 - Batches Removed by Filter: 1 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - -> Sort (actual rows=0 loops=1) + Vectorized Filter: (_hyper_2_10_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 336 + Batches Removed by Filter: 1 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 + -> 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 - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - Sort Method: quicksort - -> 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 - Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 1008 - Batches Removed by Filter: 3 - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - -> Sort (actual rows=0 loops=1) + Vectorized Filter: (_hyper_2_11_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 1008 + Batches Removed by Filter: 3 + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=0 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) - Rows Removed by Filter: 336 -(103 rows) + Filter: (_hyper_2_12_chunk.v3 > '10'::double precision) + Rows Removed by Filter: 336 +(61 rows) --- These plans are flaky between MergeAppend and Sort over Append. -SET enable_sort TO OFF; -- device_id constraint should be pushed down :PREFIX SELECT * @@ -5573,59 +5516,42 @@ RESET enable_sort; -- -- test plan time exclusion -- first chunk should be excluded +-- This plan is flaky between MergeAppend and Sort over Append. +SET enable_sort TO off; :PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-08' ORDER BY time, device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics_space (actual rows=3915 loops=1) - Order: metrics_space."time", metrics_space.device_id - -> Merge Append (actual rows=2235 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=447 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=447 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 225 - -> Sort (actual rows=1341 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=1341 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 675 - -> Sort (actual rows=447 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=447 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 225 - -> Merge Append (actual rows=1680 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) - Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) - Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 loops=1) - Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) - Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) - Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(43 rows) + QUERY PLAN +--------------------------------------------------------------------------------------------------------- + Sort (actual rows=3915 loops=1) + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _hyper_2_7_chunk (actual rows=447 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Seq Scan on _hyper_2_8_chunk (actual rows=1341 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 675 + -> Seq Scan on _hyper_2_9_chunk (actual rows=447 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) + Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Seq Scan on compress_hyper_6_20_chunk (actual rows=1 loops=1) + 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 (actual rows=1008 loops=1) + Vectorized Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) + Filter: (_ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) + Filter: ("time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(23 rows) +RESET enable_sort; -- test runtime exclusion -- first chunk should be excluded :PREFIX diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index b7ed334e8d5..021f3c657d4 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -74,13 +74,10 @@ FROM :TEST_TABLE WHERE device_id = 1 ; -RESET enable_sort; - -- -- test qual pushdown -- -- v3 is not segment by or order by column so should not be pushed down - :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE @@ -88,9 +85,6 @@ WHERE v3 > 10.0 ORDER BY time, device_id; --- These plans are flaky between MergeAppend and Sort over Append. -SET enable_sort TO OFF; - -- device_id constraint should be pushed down :PREFIX SELECT * @@ -443,13 +437,15 @@ RESET enable_sort; -- -- test plan time exclusion -- first chunk should be excluded - +-- This plan is flaky between MergeAppend and Sort over Append. +SET enable_sort TO off; :PREFIX SELECT * FROM :TEST_TABLE WHERE time > '2000-01-08' ORDER BY time, device_id; +RESET enable_sort; -- test runtime exclusion -- first chunk should be excluded From 8e16fcca47bf4a51ff600af7970129e7ec14db95 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:07:00 +0200 Subject: [PATCH 054/157] one more --- .../expected/transparent_decompression-15.out | 96 +++++++------------ .../transparent_decompression_query.sql | 3 + 2 files changed, 40 insertions(+), 59 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index b2d33ba9820..2d0f2e00046 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1265,6 +1265,8 @@ LIMIT 10; -- test ordered path -- -- should not produce ordered path +-- This plan is flaky between MergeAppend over Sorts and Sort over Append +SET enable_sort TO off; :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE @@ -1299,6 +1301,7 @@ ORDER BY time, Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (24 rows) +RESET enable_sort; -- should produce ordered path :PREFIX_VERBOSE SELECT * @@ -5036,78 +5039,53 @@ LIMIT 10; -- test ordered path -- -- should not produce ordered path +-- This plan is flaky between MergeAppend over Sorts and Sort over Append +SET enable_sort TO off; :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-08' ORDER BY time, device_id; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on public.metrics_space (actual rows=3915 loops=1) - Output: metrics_space."time", metrics_space.device_id, metrics_space.device_id_peer, metrics_space.v0, metrics_space.v1, metrics_space.v2, metrics_space.v3 - Order: metrics_space."time", metrics_space.device_id - Startup Exclusion: false - Runtime Exclusion: false - -> Merge Append (actual rows=2235 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (actual rows=447 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (actual rows=3915 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 225 - -> Sort (actual rows=1341 loops=1) + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 675 - -> Sort (actual rows=447 loops=1) + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Rows Removed by Filter: 225 - -> Merge Append (actual rows=1680 loops=1) - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - -> Sort (actual rows=336 loops=1) + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 - Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 - Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - Filter: (compress_hyper_6_20_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=1008 loops=1) + Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) + Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 + 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=1008 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 - Sort Key: _hyper_2_11_chunk."time", _hyper_2_11_chunk.device_id - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 - -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Sort (actual rows=336 loops=1) + Vectorized Filter: (_hyper_2_11_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true + -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) + Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 + Filter: (compress_hyper_6_21_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(62 rows) + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(34 rows) +RESET enable_sort; -- should produce ordered path :PREFIX_VERBOSE SELECT * diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index 021f3c657d4..8ee7180e684 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -320,12 +320,15 @@ LIMIT 10; -- -- should not produce ordered path +-- This plan is flaky between MergeAppend over Sorts and Sort over Append +SET enable_sort TO off; :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE WHERE time > '2000-01-08' ORDER BY time, device_id; +RESET enable_sort; -- should produce ordered path :PREFIX_VERBOSE From 267cc31d7e141e378e64a136264a055bb88aa040 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:16:27 +0200 Subject: [PATCH 055/157] cleanup --- .../expected/transparent_decompression-15.out | 63 +++++++++---------- .../transparent_decompression_query.sql | 15 ++--- 2 files changed, 33 insertions(+), 45 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 62fbd32600e..48ef73df8ec 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -355,8 +355,7 @@ ORDER BY time, SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1 -; +ORDER BY v1; QUERY PLAN ----------------------------------------------------------------------------------------- Sort (actual rows=1728 loops=1) @@ -381,8 +380,7 @@ ORDER BY v1 SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1 -; +ORDER BY v1; QUERY PLAN ----------------------------------------------------------------------------------------- Sort (actual rows=1728 loops=1) @@ -406,8 +404,7 @@ ORDER BY v1 :PREFIX SELECT v3 FROM :TEST_TABLE -WHERE device_id = 1 -; +WHERE device_id = 1; QUERY PLAN ----------------------------------------------------------------------------------- Append (actual rows=1728 loops=1) @@ -1566,14 +1563,11 @@ ORDER BY device_id DESC, Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (16 rows) -RESET enable_sort; -- -- test constraint exclusion -- -- test plan time exclusion -- first chunk should be excluded --- This plan is flaky between MergeAppend and Sort over Append. -SET enable_sort TO off; :PREFIX SELECT * FROM :TEST_TABLE @@ -2229,28 +2223,34 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=3456 loops=1) + Nested Loop (actual rows=3456 loops=1) Output: _hyper_1_1_chunk.device_id_peer - Hash Cond: (_hyper_1_1_chunk.device_id = "*VALUES*".column1) - -> Append (actual rows=8640 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 loops=1) + -> Unique (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Sort (actual rows=2 loops=1) + Output: "*VALUES*".column1 + Sort Key: "*VALUES*".column1 + Sort Method: quicksort + -> Values Scan on "*VALUES*" (actual rows=2 loops=1) + Output: "*VALUES*".column1 + -> Append (actual rows=1728 loops=2) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=720 loops=2) Output: _hyper_1_1_chunk.device_id_peer, _hyper_1_1_chunk.device_id Bulk Decompression: false - -> Seq Scan on _timescaledb_internal.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 _timescaledb_internal.compress_hyper_5_15_chunk (actual rows=1 loops=2) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) + Index Cond: (compress_hyper_5_15_chunk.device_id = "*VALUES*".column1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=2) Output: _hyper_1_2_chunk.device_id_peer, _hyper_1_2_chunk.device_id - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) + Filter: ("*VALUES*".column1 = _hyper_1_2_chunk.device_id) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=336 loops=2) Output: _hyper_1_3_chunk.device_id_peer, _hyper_1_3_chunk.device_id Bulk Decompression: false - -> Seq Scan 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=1 loops=2) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Hash (actual rows=2 loops=1) - Output: "*VALUES*".column1 - Buckets: 1024 Batches: 1 - -> Values Scan on "*VALUES*" (actual rows=2 loops=1) - Output: "*VALUES*".column1 -(21 rows) + Index Cond: (compress_hyper_5_16_chunk.device_id = "*VALUES*".column1) +(27 rows) RESET enable_hashjoin; RESET enable_mergejoin; @@ -3364,8 +3364,7 @@ ORDER BY time, SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1 -; +ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ Sort (actual rows=1728 loops=1) @@ -3387,8 +3386,7 @@ ORDER BY v1 SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1 -; +ORDER BY v1; QUERY PLAN ------------------------------------------------------------------------------------------ Sort (actual rows=1728 loops=1) @@ -3409,8 +3407,7 @@ ORDER BY v1 :PREFIX SELECT v3 FROM :TEST_TABLE -WHERE device_id = 1 -; +WHERE device_id = 1; QUERY PLAN ------------------------------------------------------------------------------------ Append (actual rows=1728 loops=1) @@ -5492,14 +5489,11 @@ ORDER BY device_id DESC, Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) (34 rows) -RESET enable_sort; -- -- test constraint exclusion -- -- test plan time exclusion -- first chunk should be excluded --- This plan is flaky between MergeAppend and Sort over Append. -SET enable_sort TO off; :PREFIX SELECT * FROM :TEST_TABLE @@ -6435,9 +6429,10 @@ WHERE device_id IN ( (2)); QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Hash Semi Join (actual rows=3456 loops=1) + Nested Loop Semi Join (actual rows=3456 loops=1) Output: _hyper_2_4_chunk.device_id_peer - Hash Cond: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) + Join Filter: (_hyper_2_4_chunk.device_id = "*VALUES*".column1) + Rows Removed by Join Filter: 12096 -> Append (actual rows=8640 loops=1) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_4_chunk (actual rows=720 loops=1) Output: _hyper_2_4_chunk.device_id_peer, _hyper_2_4_chunk.device_id diff --git a/tsl/test/sql/include/transparent_decompression_query.sql b/tsl/test/sql/include/transparent_decompression_query.sql index e51bf7bc0c9..5b3b67aa7a1 100644 --- a/tsl/test/sql/include/transparent_decompression_query.sql +++ b/tsl/test/sql/include/transparent_decompression_query.sql @@ -17,7 +17,6 @@ FROM :TEST_TABLE WHERE device_id = 1 ORDER BY time; - -- test empty targetlist :PREFIX SELECT @@ -56,28 +55,26 @@ ORDER BY time, SELECT v1 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1 -; +ORDER BY v1; -- test order not present in targetlist :PREFIX SELECT v2 FROM :TEST_TABLE WHERE device_id = 1 -ORDER BY v1 -; +ORDER BY v1; -- test column with all NULL :PREFIX SELECT v3 FROM :TEST_TABLE -WHERE device_id = 1 -; +WHERE device_id = 1; -- -- test qual pushdown -- -- v3 is not segment by or order by column so should not be pushed down + :PREFIX_VERBOSE SELECT * FROM :TEST_TABLE @@ -433,15 +430,11 @@ ORDER BY device_id DESC, v1, time; -RESET enable_sort; - -- -- test constraint exclusion -- -- test plan time exclusion -- first chunk should be excluded --- This plan is flaky between MergeAppend and Sort over Append. -SET enable_sort TO off; :PREFIX SELECT * FROM :TEST_TABLE From 21ad1dc8289c583b09732fe224036eb4e6bd7f66 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:49:19 +0200 Subject: [PATCH 056/157] no idea what all this code is doing --- src/nodes/chunk_append/planner.c | 133 +++++++++++++++---------------- 1 file changed, 65 insertions(+), 68 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index aa72d22df86..499e77a8449 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -66,16 +66,12 @@ static Plan * adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List *tlist, AttrNumber *sortColIdx) { - AppendRelInfo *appinfo = ts_get_appendrelinfo(root, path->parent->relid, false); int childSortCols; Oid *sortOperators; Oid *collations; bool *nullsFirst; AttrNumber *childColIdx; - /* push down targetlist to children */ - plan->targetlist = castNode(List, adjust_appendrel_attrs(root, (Node *) tlist, 1, &appinfo)); - /* Compute sort column info, and adjust subplan's tlist as needed */ plan = ts_prepare_sort_from_pathkeys(plan, pathkeys, @@ -143,34 +139,35 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path cscan->scan.plan.targetlist = tlist; - if (path->path.pathkeys == NIL) + ListCell *lc_plan, *lc_path; + forboth (lc_path, path->custom_paths, lc_plan, custom_plans) { - ListCell *lc_plan, *lc_path; - forboth (lc_path, path->custom_paths, lc_plan, custom_plans) - { - Plan *child_plan = lfirst(lc_plan); - Path *child_path = lfirst(lc_path); + Plan *child_plan = lfirst(lc_plan); + Path *child_path = lfirst(lc_path); - /* push down targetlist to children */ - if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) - { - /* if this is an append child we need to adjust targetlist references */ - AppendRelInfo *appinfo = - ts_get_appendrelinfo(root, child_path->parent->relid, false); + /* push down targetlist to children */ + if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) + { + /* if this is an append child we need to adjust targetlist references */ + AppendRelInfo *appinfo = + ts_get_appendrelinfo(root, child_path->parent->relid, false); - child_plan->targetlist = - castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); - } - else - { - /* - * This can also be a MergeAppend path building the entire - * hypertable, in case we have a single partial chunk. - */ - child_plan->targetlist = tlist; - } + child_plan->targetlist = + castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); + } + else + { + /* + * This can also be a MergeAppend path building the entire + * hypertable, in case we have a single partial chunk. + */ + child_plan->targetlist = tlist; } } + + if (path->path.pathkeys == NIL) + { + } else { /* @@ -235,47 +232,47 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path */ if (IsA(lfirst(lc_plan), MergeAppend)) { - ListCell *lc_childpath, *lc_childplan; - MergeAppend *merge_plan = castNode(MergeAppend, lfirst(lc_plan)); - MergeAppendPath *merge_path = castNode(MergeAppendPath, lfirst(lc_path)); - Index current_group_relid = - ((Path *) linitial(merge_path->subpaths))->parent->relid; - - /* - * Since for space partitioning the MergeAppend below ChunkAppend - * still has the hypertable as rel we can copy sort properties and - * target list from toplevel ChunkAppend. - */ - merge_plan->plan.targetlist = cscan->scan.plan.targetlist; - merge_plan->sortColIdx = sortColIdx; - merge_plan->sortOperators = sortOperators; - merge_plan->collations = collations; - merge_plan->nullsFirst = nullsFirst; - bool partial_chunks = true; - - /* children will have same parent relid if we have partial chunks */ - foreach (lc_childpath, merge_path->subpaths) - { - Path *child = lfirst(lc_childpath); - if (child->parent->relid != current_group_relid) - partial_chunks = false; - } - - forboth (lc_childpath, merge_path->subpaths, lc_childplan, merge_plan->mergeplans) - { - /* - * Skip this invocation in the existence of partial chunks because it - * will add an unnecessary sort node, create_merge_append_plan has already - * adjusted the childscan with a sort node if required - */ - if (!partial_chunks) - lfirst(lc_childplan) = adjust_childscan(root, - lfirst(lc_childplan), - lfirst(lc_childpath), - pathkeys, - orig_tlist, - sortColIdx); - } +// ListCell *lc_childpath, *lc_childplan; +// MergeAppend *merge_plan = castNode(MergeAppend, lfirst(lc_plan)); +// MergeAppendPath *merge_path = castNode(MergeAppendPath, lfirst(lc_path)); +// Index current_group_relid = +// ((Path *) linitial(merge_path->subpaths))->parent->relid; + +// /* +// * Since for space partitioning the MergeAppend below ChunkAppend +// * still has the hypertable as rel we can copy sort properties and +// * target list from toplevel ChunkAppend. +// */ +// merge_plan->plan.targetlist = cscan->scan.plan.targetlist; +// merge_plan->sortColIdx = sortColIdx; +// merge_plan->sortOperators = sortOperators; +// merge_plan->collations = collations; +// merge_plan->nullsFirst = nullsFirst; +// bool partial_chunks = true; + +// /* children will have same parent relid if we have partial chunks */ +// foreach (lc_childpath, merge_path->subpaths) +// { +// Path *child = lfirst(lc_childpath); +// if (child->parent->relid != current_group_relid) +// partial_chunks = false; +// } + +// forboth (lc_childpath, merge_path->subpaths, lc_childplan, merge_plan->mergeplans) +// { +// /* +// * Skip this invocation in the existence of partial chunks because it +// * will add an unnecessary sort node, create_merge_append_plan has already +// * adjusted the childscan with a sort node if required +// */ +// if (!partial_chunks) +// lfirst(lc_childplan) = adjust_childscan(root, +// lfirst(lc_childplan), +// lfirst(lc_childpath), +// pathkeys, +// orig_tlist, +// sortColIdx); +// } } else { From 033c6c91cd0ce874ca7194e41f828ffdad2085e4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 13:09:37 +0200 Subject: [PATCH 057/157] cleanup --- src/nodes/chunk_append/planner.c | 63 ++++---------------------------- 1 file changed, 8 insertions(+), 55 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index 499e77a8449..c2609d6250c 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -86,7 +86,6 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List /* inject sort node if child sort order does not match desired order */ if (!pathkeys_contained_in(pathkeys, path->pathkeys)) -// if (!pathkeys_contained_in(pathkeys, path->pathkeys) && !IsA(plan, Sort)) { Plan *child = plan; if (IsA(plan, Sort)) @@ -149,8 +148,7 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path if (child_path->parent->reloptkind == RELOPT_OTHER_MEMBER_REL) { /* if this is an append child we need to adjust targetlist references */ - AppendRelInfo *appinfo = - ts_get_appendrelinfo(root, child_path->parent->relid, false); + AppendRelInfo *appinfo = ts_get_appendrelinfo(root, child_path->parent->relid, false); child_plan->targetlist = castNode(List, adjust_appendrel_attrs(root, (Node *) orig_tlist, 1, &appinfo)); @@ -165,10 +163,7 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path } } - if (path->path.pathkeys == NIL) - { - } - else + if (path->path.pathkeys != NIL) { /* * If this is an ordered append node we need to ensure the columns @@ -176,7 +171,6 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path * return sorted output. Children not returning sorted output will be * wrapped in a sort node. */ - ListCell *lc_plan, *lc_path; int numCols; AttrNumber *sortColIdx; Oid *sortOperators; @@ -227,54 +221,13 @@ ts_chunk_append_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *path /* * This could be a MergeAppend due to space partitioning, or - * due to partially compressed chunks. In the second case, there is - * no need to inject sort nodes + * due to partially compressed chunks. The MergeAppend plan adds + * sort to it children, and has the proper sorting itself, so no + * need to do anything for it. + * We can also have plain chunk scans here which might require a + * Sort. */ - if (IsA(lfirst(lc_plan), MergeAppend)) - { -// ListCell *lc_childpath, *lc_childplan; -// MergeAppend *merge_plan = castNode(MergeAppend, lfirst(lc_plan)); -// MergeAppendPath *merge_path = castNode(MergeAppendPath, lfirst(lc_path)); -// Index current_group_relid = -// ((Path *) linitial(merge_path->subpaths))->parent->relid; - -// /* -// * Since for space partitioning the MergeAppend below ChunkAppend -// * still has the hypertable as rel we can copy sort properties and -// * target list from toplevel ChunkAppend. -// */ -// merge_plan->plan.targetlist = cscan->scan.plan.targetlist; -// merge_plan->sortColIdx = sortColIdx; -// merge_plan->sortOperators = sortOperators; -// merge_plan->collations = collations; -// merge_plan->nullsFirst = nullsFirst; -// bool partial_chunks = true; - -// /* children will have same parent relid if we have partial chunks */ -// foreach (lc_childpath, merge_path->subpaths) -// { -// Path *child = lfirst(lc_childpath); -// if (child->parent->relid != current_group_relid) -// partial_chunks = false; -// } - -// forboth (lc_childpath, merge_path->subpaths, lc_childplan, merge_plan->mergeplans) -// { -// /* -// * Skip this invocation in the existence of partial chunks because it -// * will add an unnecessary sort node, create_merge_append_plan has already -// * adjusted the childscan with a sort node if required -// */ -// if (!partial_chunks) -// lfirst(lc_childplan) = adjust_childscan(root, -// lfirst(lc_childplan), -// lfirst(lc_childpath), -// pathkeys, -// orig_tlist, -// sortColIdx); -// } - } - else + if (!IsA(lfirst(lc_plan), MergeAppend)) { lfirst(lc_plan) = adjust_childscan(root, lfirst(lc_plan), From c22b2d79028a4a3fd4216c9ec100371fd95860e4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:14:16 +0200 Subject: [PATCH 058/157] reference REL_16_3 transparent_decompression-* --- .../expected/transparent_decompression-16.out | 983 +++++++----------- 1 file changed, 347 insertions(+), 636 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index 38d403c0318..d6d583e1634 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -244,22 +244,22 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=1728 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2688 -> Sort (actual rows=336 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -328,83 +328,27 @@ SELECT time_bucket ('1d', time), FROM :TEST_TABLE WHERE device_id IN (1, 2) ORDER BY time, - device_id; + 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) + Sort (actual rows=3456 loops=1) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Method: quicksort + -> Result (actual rows=3456 loops=1) + -> Append (actual rows=3456 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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) + -> Seq Scan on _hyper_1_2_chunk (actual rows=1344 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) + Rows Removed by Filter: 2016 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=672 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) - --- test empty targetlist -:PREFIX -SELECT -FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (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 (actual rows=2520 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -(6 rows) - --- test empty resultset -:PREFIX -SELECT * -FROM :TEST_TABLE -WHERE device_id < 0; - 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 - -> 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) - --- test targetlist not referencing columns -:PREFIX -SELECT 1 -FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=6840 loops=1) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (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 (actual rows=2520 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -(7 rows) +(16 rows) -- test constraints not present in targetlist :PREFIX @@ -414,18 +358,18 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ----------------------------------------------------------------------------------------- - Sort (actual rows=1368 loops=1) + Sort (actual rows=1728 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) + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -439,18 +383,18 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ----------------------------------------------------------------------------------------- - Sort (actual rows=1368 loops=1) + Sort (actual rows=1728 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) + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -463,15 +407,15 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ----------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -810,7 +754,7 @@ LIMIT 10; 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 + Rows Removed by Filter: 3595 -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_5_15_chunk.device_id Sort Method: quicksort @@ -1810,44 +1754,44 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ - Merge Join (actual rows=1368 loops=1) + Merge Join (actual rows=1728 loops=1) Merge Cond: (metrics."time" = metrics_1."time") -> Custom Scan (ChunkAppend) on metrics (actual rows=1728 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2688 -> Sort (actual rows=336 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Materialize (actual rows=1368 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) + -> Materialize (actual rows=1728 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1728 loops=1) Order: metrics_1."time" -> Sort (actual rows=720 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=672 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2688 -> Sort (actual rows=336 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=336 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 @@ -1864,7 +1808,7 @@ WHERE device_id = 1; 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -1873,7 +1817,7 @@ WHERE device_id = 1; Filter: (device_id = 1) Rows Removed by Filter: 2688 -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -2107,7 +2051,7 @@ ORDER BY device_id; -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false -> 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) @@ -2219,21 +2163,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 13680 - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) + Rows Removed by Join Filter: 17280 + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 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=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=6840) + -> Materialize (actual rows=2 loops=8640) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2255,7 +2199,7 @@ WHERE device_id IN ( Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) Rows Removed by Filter: 2688 @@ -2356,7 +2300,7 @@ WHERE device_id IN ( Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) Rows Removed by Filter: 2688 @@ -2511,7 +2455,7 @@ FROM :TEST_TABLE m1 -> Append (actual rows=1 loops=10) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=1 loops=10) Filter: ("time" = m1."time") - Rows Removed by Filter: 323 + Rows Removed by Filter: 647 -> 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) @@ -2519,7 +2463,7 @@ FROM :TEST_TABLE m1 Filter: (m1.device_id = device_id) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (actual rows=0 loops=9) Filter: ("time" = m1."time") - Rows Removed by Filter: 504 + Rows Removed by Filter: 336 -> 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) -> Materialize (actual rows=10 loops=1) @@ -2528,7 +2472,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 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 @@ -2538,7 +2482,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=1 loops=1) Sort Key: m3_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=336 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 @@ -2555,12 +2499,11 @@ FROM :TEST_TABLE m1 m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) - -> Nested Loop (actual rows=100 loops=1) - Join Filter: (m1."time" = m2_1."time") - Rows Removed by Join Filter: 135432 + -> Merge Join (actual rows=100 loops=1) + Merge Cond: (m1."time" = m2."time") -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1) Order: m1."time" -> Sort (actual rows=100 loops=1) @@ -2577,20 +2520,24 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) - -> Materialize (actual rows=1355 loops=100) - -> Append (actual rows=1368 loops=1) - -> 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 - -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=504 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=100 loops=1) + Order: m2."time" + -> Sort (actual rows=100 loops=1) + Sort Key: m2_1."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (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 -(33 rows) + -> 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) +(36 rows) :PREFIX SELECT * @@ -2730,7 +2677,7 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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 @@ -2787,33 +2734,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2826,21 +2764,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk m2_9 (never executed) Index Cond: (device_id = 2) -(84 rows) +(71 rows) -- test implicit self-join :PREFIX @@ -2992,7 +2926,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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 _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) @@ -3000,7 +2934,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': 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 + Rows Removed by Filter: 160 -> 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) @@ -3015,7 +2949,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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 @@ -3025,7 +2959,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 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 + Rows Removed by Filter: 160 -> 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 @@ -3628,22 +3562,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3658,11 +3586,9 @@ LIMIT 10; Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id IS NOT NULL) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id IS NOT NULL) +(53 rows) :PREFIX SELECT * @@ -3671,8 +3597,8 @@ WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3704,27 +3630,18 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3744,12 +3661,9 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) -(76 rows) + -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) +(64 rows) -- test IN (Const,Const) :PREFIX @@ -3759,8 +3673,8 @@ WHERE device_id IN (1, 2) ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3783,16 +3697,12 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3805,7 +3715,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) -> Seq Scan on compress_hyper_6_21_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) -(44 rows) +(40 rows) -- test cast pushdown :PREFIX @@ -3876,30 +3786,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3919,13 +3820,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 336 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 336 +(68 rows) :PREFIX SELECT * @@ -3963,22 +3861,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3993,11 +3885,9 @@ LIMIT 10; Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id_peer < device_id) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id_peer < device_id) +(53 rows) -- test expressions :PREFIX @@ -4248,22 +4138,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4280,11 +4164,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(61 rows) :PREFIX SELECT * @@ -4328,22 +4210,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4360,11 +4236,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(61 rows) :PREFIX SELECT * @@ -4408,22 +4282,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4440,11 +4308,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") +(61 rows) --pushdowns between order by and segment by columns :PREFIX @@ -4454,8 +4320,8 @@ WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4490,27 +4356,18 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4532,13 +4389,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v0 < 1) - Rows Removed by Filter: 336 -(82 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v0 < 1) + Rows Removed by Filter: 336 +(70 rows) :PREFIX SELECT * @@ -4583,30 +4437,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4628,13 +4473,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 336 -(85 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 336 +(73 rows) :PREFIX SELECT * @@ -4675,22 +4517,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id < v0) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id < v0) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id < v0) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4707,11 +4543,9 @@ LIMIT 10; Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id < v0) -(66 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id < v0) +(58 rows) :PREFIX SELECT * @@ -4753,30 +4587,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4796,13 +4621,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 336 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 336 +(68 rows) --pushdown between two order by column (not pushed down) :PREFIX @@ -4845,30 +4667,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4888,13 +4701,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 336 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 336 +(68 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE @@ -4985,22 +4795,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -5017,11 +4821,9 @@ LIMIT 10; Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(68 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) +(60 rows) --functions not yet optimized :PREFIX @@ -5060,22 +4862,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" < now()) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" < now()) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" < now()) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -5090,11 +4886,9 @@ LIMIT 10; -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" < now()) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" < now()) +(53 rows) -- test sort optimization interaction :PREFIX @@ -5468,15 +5262,15 @@ ORDER BY device_id, Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) 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 @@ -5517,15 +5311,15 @@ ORDER BY device_id, Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) 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 @@ -5742,8 +5536,8 @@ FROM :TEST_TABLE WHERE time > '2000-01-08'::text::timestamptz ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Custom Scan (ChunkAppend) on metrics_space (actual rows=3915 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) @@ -5777,27 +5571,18 @@ ORDER BY time, -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=447 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=447 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=447 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Sort (actual rows=1341 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=1341 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1341 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1341 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=447 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=447 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=447 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Merge Append (actual rows=1680 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=336 loops=1) @@ -5817,12 +5602,9 @@ ORDER BY time, -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -(78 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) + Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) +(66 rows) -- test aggregate :PREFIX @@ -6181,11 +5963,11 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort @@ -6288,7 +6070,7 @@ ORDER BY device_id; Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false -> 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) @@ -6354,13 +6136,13 @@ ORDER BY device_id; -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=2016 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=672 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false -> 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) @@ -6890,19 +6672,13 @@ FROM :TEST_TABLE m1 Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) -> Sort (never executed) Sort Key: m1_5."time", m1_5.device_id - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) -> Sort (never executed) Sort Key: m1_6."time", m1_6.device_id - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) -> Merge Append (never executed) Sort Key: m1_7."time", m1_7.device_id -> Sort (never executed) @@ -6915,9 +6691,7 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) -> Materialize (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=10 loops=1) Order: m2."time", m2.device_id @@ -6942,19 +6716,13 @@ FROM :TEST_TABLE m1 Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) Sort Key: m2_4."time", m2_4.device_id - -> Sort (never executed) - Sort Key: m2_4."time", m2_4.device_id - -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) -> Sort (never executed) Sort Key: m2_5."time", m2_5.device_id - -> Sort (never executed) - Sort Key: m2_5."time", m2_5.device_id - -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) -> Sort (never executed) Sort Key: m2_6."time", m2_6.device_id - -> Sort (never executed) - Sort Key: m2_6."time", m2_6.device_id - -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) -> Merge Append (never executed) Sort Key: m2_7."time", m2_7.device_id -> Sort (never executed) @@ -6967,10 +6735,8 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id - -> Sort (never executed) - Sort Key: m2_9."time", m2_9.device_id - -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) -(106 rows) + -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) +(90 rows) :PREFIX SELECT * @@ -7012,19 +6778,13 @@ FROM :TEST_TABLE m1 Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) Sort Key: m2_4."time", m2_4.device_id - -> Sort (never executed) - Sort Key: m2_4."time", m2_4.device_id - -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) -> Sort (never executed) Sort Key: m2_5."time", m2_5.device_id - -> Sort (never executed) - Sort Key: m2_5."time", m2_5.device_id - -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) -> Sort (never executed) Sort Key: m2_6."time", m2_6.device_id - -> Sort (never executed) - Sort Key: m2_6."time", m2_6.device_id - -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) -> Merge Append (never executed) Sort Key: m2_7."time", m2_7.device_id -> Sort (never executed) @@ -7037,9 +6797,7 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id - -> Sort (never executed) - Sort Key: m2_9."time", m2_9.device_id - -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) -> Materialize (actual rows=49 loops=1) -> Nested Loop (actual rows=11 loops=1) Join Filter: (m1_1."time" = m3_1."time") @@ -7072,7 +6830,7 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=336 loops=1) -(88 rows) +(80 rows) :PREFIX SELECT * @@ -7214,19 +6972,13 @@ LIMIT 10; Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) -> Sort (never executed) Sort Key: m1_5."time", m1_5.device_id - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) -> Sort (never executed) Sort Key: m1_6."time", m1_6.device_id - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) -> Merge Append (never executed) Sort Key: m1_7."time", m1_7.device_id -> Sort (never executed) @@ -7239,9 +6991,7 @@ LIMIT 10; -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) -> Materialize (actual rows=49 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" @@ -7250,27 +7000,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=2160 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7280,18 +7021,14 @@ LIMIT 10; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) -(105 rows) +(84 rows) :PREFIX SELECT * @@ -7358,33 +7095,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7397,21 +7125,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk m2_9 (never executed) Index Cond: (device_id = 2) -(105 rows) +(92 rows) :PREFIX SELECT * @@ -7457,33 +7181,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7496,21 +7211,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_time_idx on _hyper_2_12_chunk m2_9 (never executed) Index Cond: (device_id = 2) -(84 rows) +(71 rows) -- test implicit self-join :PREFIX From d40119f2acff729dc9d67a36cd04124f19c686d0 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:15:08 +0200 Subject: [PATCH 059/157] reference REL_14_11 transparent_decompression-* --- .../expected/transparent_decompression-14.out | 998 +++++++----------- 1 file changed, 355 insertions(+), 643 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 527d7cdb711..78e1a02b51f 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -244,22 +244,22 @@ WHERE device_id = 1 ORDER BY time; QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - Custom Scan (ChunkAppend) on metrics (actual rows=1368 loops=1) + Custom Scan (ChunkAppend) on metrics (actual rows=1728 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2688 -> Sort (actual rows=336 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -328,82 +328,27 @@ SELECT time_bucket ('1d', time), 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) - 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) + device_id +; + QUERY PLAN +------------------------------------------------------------------------------------------------ + Sort (actual rows=3456 loops=1) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device_id + Sort Method: quicksort + -> Result (actual rows=3456 loops=1) + -> Append (actual rows=3456 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=1440 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 + -> Seq Scan on _hyper_1_2_chunk (actual rows=1344 loops=1) Filter: (device_id = ANY ('{1,2}'::integer[])) - Rows Removed by Filter: 3 -(22 rows) - --- test empty targetlist -:PREFIX -SELECT -FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------- - Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (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 (actual rows=2520 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -(6 rows) - --- test empty resultset -:PREFIX -SELECT * -FROM :TEST_TABLE -WHERE device_id < 0; - 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 - -> 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) - --- test targetlist not referencing columns -:PREFIX -SELECT 1 -FROM :TEST_TABLE; - QUERY PLAN ------------------------------------------------------------------------------------------- - Result (actual rows=6840 loops=1) - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (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 (actual rows=2520 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=2520 loops=1) - -> Seq Scan on compress_hyper_5_16_chunk (actual rows=5 loops=1) -(7 rows) + Rows Removed by Filter: 2016 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=672 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 +(16 rows) -- test constraints not present in targetlist :PREFIX @@ -413,18 +358,18 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ----------------------------------------------------------------------------------------- - Sort (actual rows=1368 loops=1) + Sort (actual rows=1728 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) + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -438,18 +383,18 @@ WHERE device_id = 1 ORDER BY v1; QUERY PLAN ----------------------------------------------------------------------------------------- - Sort (actual rows=1368 loops=1) + Sort (actual rows=1728 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) + -> Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -462,15 +407,15 @@ FROM :TEST_TABLE WHERE device_id = 1; QUERY PLAN ----------------------------------------------------------------------------------- - Append (actual rows=1368 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=360 loops=1) + Append (actual rows=1728 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + Rows Removed by Filter: 2688 + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -809,7 +754,7 @@ LIMIT 10; 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 + Rows Removed by Filter: 3595 -> Sort (actual rows=5 loops=1) Sort Key: compress_hyper_5_15_chunk.device_id Sort Method: quicksort @@ -1809,44 +1754,44 @@ FROM q1 ORDER BY q1.time; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ - Merge Join (actual rows=1368 loops=1) + Merge Join (actual rows=1728 loops=1) Merge Cond: (metrics."time" = metrics_1."time") -> Custom Scan (ChunkAppend) on metrics (actual rows=1728 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=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk (actual rows=672 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 2688 -> Sort (actual rows=336 loops=1) Sort Key: _hyper_1_3_chunk."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 - -> Materialize (actual rows=1368 loops=1) - -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1368 loops=1) + -> Materialize (actual rows=1728 loops=1) + -> Custom Scan (ChunkAppend) on metrics metrics_1 (actual rows=1728 loops=1) Order: metrics_1."time" -> Sort (actual rows=720 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk _hyper_1_1_chunk_1 (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=504 loops=1) + -> Index Scan Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk _hyper_1_2_chunk_1 (actual rows=672 loops=1) Filter: (device_id = 2) Rows Removed by Filter: 2688 -> Sort (actual rows=336 loops=1) 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) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk _hyper_1_3_chunk_1 (actual rows=336 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 @@ -1863,7 +1808,7 @@ WHERE device_id = 1; 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) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=720 loops=1) -> Seq Scan on compress_hyper_5_15_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -1872,7 +1817,7 @@ WHERE device_id = 1; Filter: (device_id = 1) Rows Removed by Filter: 2688 -> Partial Aggregate (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=336 loops=1) -> Seq Scan on compress_hyper_5_16_chunk (actual rows=1 loops=1) Filter: (device_id = 1) Rows Removed by Filter: 4 @@ -2106,7 +2051,7 @@ ORDER BY device_id; -> Index Only Scan using _hyper_1_2_chunk_tmp_idx on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 loops=1) Output: _hyper_1_3_chunk.device_id Bulk Decompression: false -> 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) @@ -2218,21 +2163,21 @@ WHERE device_id_peer IN ( Nested Loop Semi Join (actual rows=0 loops=1) Output: _hyper_1_1_chunk.device_id_peer Join Filter: (_hyper_1_1_chunk.device_id_peer = "*VALUES*".column1) - Rows Removed by Join Filter: 13680 - -> Append (actual rows=6840 loops=1) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=1800 loops=1) + Rows Removed by Join Filter: 17280 + -> Append (actual rows=8640 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk (actual rows=3600 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=5 loops=1) Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2520 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=3360 loops=1) Output: _hyper_1_2_chunk.device_id_peer - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=2520 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - -> Materialize (actual rows=2 loops=6840) + -> Materialize (actual rows=2 loops=8640) Output: "*VALUES*".column1 -> Values Scan on "*VALUES*" (actual rows=2 loops=1) Output: "*VALUES*".column1 @@ -2254,7 +2199,7 @@ WHERE device_id IN ( Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) Rows Removed by Filter: 2688 @@ -2355,7 +2300,7 @@ WHERE device_id IN ( Output: compress_hyper_5_15_chunk._ts_meta_count, compress_hyper_5_15_chunk._ts_meta_sequence_num, compress_hyper_5_15_chunk.device_id, compress_hyper_5_15_chunk.device_id_peer, compress_hyper_5_15_chunk._ts_meta_min_3, compress_hyper_5_15_chunk._ts_meta_max_3, compress_hyper_5_15_chunk."time", compress_hyper_5_15_chunk._ts_meta_min_1, compress_hyper_5_15_chunk._ts_meta_max_1, compress_hyper_5_15_chunk.v0, compress_hyper_5_15_chunk._ts_meta_min_2, compress_hyper_5_15_chunk._ts_meta_max_2, compress_hyper_5_15_chunk.v1, compress_hyper_5_15_chunk.v2, compress_hyper_5_15_chunk.v3 Filter: (compress_hyper_5_15_chunk.device_id = 1) Rows Removed by Filter: 4 - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=504 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=672 loops=1) Output: _hyper_1_2_chunk.device_id_peer Filter: (_hyper_1_2_chunk.device_id = 1) Rows Removed by Filter: 2688 @@ -2510,7 +2455,7 @@ FROM :TEST_TABLE m1 -> 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 + Rows Removed by Filter: 647 -> 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) @@ -2518,7 +2463,7 @@ FROM :TEST_TABLE m1 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 + Rows Removed by Filter: 336 -> 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) -> Materialize (actual rows=10 loops=1) @@ -2527,7 +2472,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=3 loops=1) Sort Key: m3_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m3_1 (actual rows=720 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 @@ -2537,7 +2482,7 @@ FROM :TEST_TABLE m1 -> Sort (actual rows=1 loops=1) Sort Key: m3_3."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m3_3 (actual rows=336 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 @@ -2554,12 +2499,11 @@ FROM :TEST_TABLE m1 m2.time, m2.device_id LIMIT 100; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=100 loops=1) - -> Nested Loop (actual rows=100 loops=1) - Join Filter: (m1."time" = m2_1."time") - Rows Removed by Join Filter: 135432 + -> Merge Join (actual rows=100 loops=1) + Merge Cond: (m1."time" = m2."time") -> Custom Scan (ChunkAppend) on metrics m1 (actual rows=100 loops=1) Order: m1."time" -> Sort (actual rows=100 loops=1) @@ -2576,20 +2520,24 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m1_3 (never executed) -> Seq Scan on compress_hyper_5_16_chunk (never executed) Filter: (device_id = 1) - -> Materialize (actual rows=1355 loops=100) - -> Append (actual rows=1368 loops=1) - -> 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 - -> Seq Scan on _hyper_1_2_chunk m2_2 (actual rows=504 loops=1) + -> Materialize (actual rows=100 loops=1) + -> Custom Scan (ChunkAppend) on metrics m2 (actual rows=100 loops=1) + Order: m2."time" + -> Sort (actual rows=100 loops=1) + Sort Key: m2_1."time" + Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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 Backward using _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m2_2 (never executed) Filter: (device_id = 2) - Rows Removed by Filter: 2016 - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk m2_3 (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 -(33 rows) + -> 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) +(36 rows) :PREFIX SELECT * @@ -2729,7 +2677,7 @@ LIMIT 100; -> Sort (actual rows=21 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=360 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m2_1 (actual rows=720 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 @@ -2786,33 +2734,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -2825,21 +2764,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) Filter: (device_id = 2) -(84 rows) +(71 rows) -- test implicit self-join :PREFIX @@ -2991,7 +2926,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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 _hyper_1_2_chunk_metrics_time_idx on _hyper_1_2_chunk m1_2 (actual rows=1 loops=7) @@ -2999,7 +2934,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': 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 + Rows Removed by Filter: 160 -> 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) @@ -3014,7 +2949,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Chunks excluded during runtime: 2 -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk m1_1 (actual rows=1 loops=5) Filter: ("time" = g."time") - Rows Removed by Filter: 168 + Rows Removed by Filter: 336 -> 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 @@ -3024,7 +2959,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-02-01'::timestamptz, '1d': Rows Removed by Filter: 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 + Rows Removed by Filter: 160 -> 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 @@ -3627,22 +3562,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id IS NOT NULL) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id IS NOT NULL) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3657,11 +3586,9 @@ LIMIT 10; Filter: (device_id IS NOT NULL) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id IS NOT NULL) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id IS NOT NULL) +(53 rows) :PREFIX SELECT * @@ -3670,8 +3597,8 @@ WHERE device_id IS NULL ORDER BY time, device_id LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3703,27 +3630,18 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3743,12 +3661,9 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) - Index Cond: (device_id IS NULL) -(76 rows) + -> Index Scan using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=0 loops=1) + Index Cond: (device_id IS NULL) +(64 rows) -- test IN (Const,Const) :PREFIX @@ -3758,8 +3673,8 @@ WHERE device_id IN (1, 2) ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=10 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -3782,16 +3697,12 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id = ANY ('{1,2}'::integer[])) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (never executed) + Index Cond: (device_id = ANY ('{1,2}'::integer[])) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3804,7 +3715,7 @@ LIMIT 10; -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (never executed) -> Seq Scan on compress_hyper_6_21_chunk (never executed) Filter: (device_id = ANY ('{1,2}'::integer[])) -(44 rows) +(40 rows) -- test cast pushdown :PREFIX @@ -3875,30 +3786,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -3918,13 +3820,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (device_id = device_id_peer) - Rows Removed by Filter: 336 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (device_id = device_id_peer) + Rows Removed by Filter: 336 +(68 rows) :PREFIX SELECT * @@ -3962,22 +3861,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id_peer < device_id) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id_peer < device_id) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -3992,11 +3885,9 @@ LIMIT 10; Filter: (device_id_peer < device_id) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id_peer < device_id) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id_peer < device_id) +(53 rows) -- test expressions :PREFIX @@ -4247,22 +4138,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4279,11 +4164,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" >= 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(61 rows) :PREFIX SELECT * @@ -4327,22 +4210,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4359,11 +4236,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) +(61 rows) :PREFIX SELECT * @@ -4407,22 +4282,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4439,11 +4308,9 @@ LIMIT 10; Filter: (_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") -(69 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ('Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone < "time") +(61 rows) --pushdowns between order by and segment by columns :PREFIX @@ -4453,8 +4320,8 @@ WHERE v0 < 1 ORDER BY time, device_id LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (actual rows=0 loops=1) -> Custom Scan (ChunkAppend) on metrics_space (actual rows=0 loops=1) Order: metrics_space."time", metrics_space.device_id @@ -4489,27 +4356,18 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) - Index Cond: (v0 < 1) + -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=0 loops=1) + Index Cond: (v0 < 1) -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4531,13 +4389,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v0 < 1) - Rows Removed by Filter: 336 -(82 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v0 < 1) + Rows Removed by Filter: 336 +(70 rows) :PREFIX SELECT * @@ -4582,30 +4437,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4627,13 +4473,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v0 < device_id) - Rows Removed by Filter: 336 -(85 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v0 < device_id) + Rows Removed by Filter: 336 +(73 rows) :PREFIX SELECT * @@ -4674,22 +4517,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (device_id < v0) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (device_id < v0) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (device_id < v0) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (device_id < v0) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -4706,11 +4543,9 @@ LIMIT 10; Filter: (_ts_meta_max_1 > device_id) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (device_id < v0) -(66 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (device_id < v0) +(58 rows) :PREFIX SELECT * @@ -4752,30 +4587,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4795,13 +4621,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: (v1 = (device_id)::double precision) - Rows Removed by Filter: 336 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: (v1 = (device_id)::double precision) + Rows Removed by Filter: 336 +(68 rows) --pushdown between two order by column (not pushed down) :PREFIX @@ -4844,30 +4667,21 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_7_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 672 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 2016 + -> Seq Scan on _hyper_2_8_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 2016 -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 672 + -> Seq Scan on _hyper_2_9_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 672 -> Merge Append (actual rows=0 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=0 loops=1) @@ -4887,13 +4701,10 @@ LIMIT 10; -> Sort (actual rows=0 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) - Filter: ((v0)::double precision = v1) - Rows Removed by Filter: 336 -(80 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=0 loops=1) + Filter: ((v0)::double precision = v1) + Rows Removed by Filter: 336 +(68 rows) --pushdown of quals on order by and segment by cols anded together :PREFIX_VERBOSE @@ -4984,22 +4795,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -5016,11 +4821,9 @@ LIMIT 10; Filter: ((_ts_meta_max_3 > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) -(68 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: (("time" > 'Fri Dec 31 17:00:00 1999 PST'::timestamp with time zone) OR (device_id = 1)) +(60 rows) --functions not yet optimized :PREFIX @@ -5059,22 +4862,16 @@ LIMIT 10; Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id -> Sort (never executed) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - -> Seq Scan on _hyper_2_7_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_7_chunk (never executed) + Filter: ("time" < now()) -> Sort (never executed) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - -> Seq Scan on _hyper_2_8_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_8_chunk (never executed) + Filter: ("time" < now()) -> Sort (never executed) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - -> Seq Scan on _hyper_2_9_chunk (never executed) - Filter: ("time" < now()) + -> Seq Scan on _hyper_2_9_chunk (never executed) + Filter: ("time" < now()) -> Merge Append (never executed) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (never executed) @@ -5089,11 +4886,9 @@ LIMIT 10; -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Sort (never executed) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - -> Seq Scan on _hyper_2_12_chunk (never executed) - Filter: ("time" < now()) -(61 rows) + -> Seq Scan on _hyper_2_12_chunk (never executed) + Filter: ("time" < now()) +(53 rows) -- test sort optimization interaction :PREFIX @@ -5467,15 +5262,15 @@ ORDER BY device_id, Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) 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 @@ -5516,15 +5311,15 @@ ORDER BY device_id, Output: _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1005 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) Output: _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1 Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=335 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_t on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) Output: _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1 Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) 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 @@ -5741,8 +5536,8 @@ FROM :TEST_TABLE WHERE time > '2000-01-08'::text::timestamptz ORDER BY time, device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Custom Scan (ChunkAppend) on metrics_space (actual rows=3915 loops=1) Order: metrics_space."time", metrics_space.device_id -> Merge Append (actual rows=0 loops=1) @@ -5776,27 +5571,18 @@ ORDER BY time, -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=447 loops=1) - Sort Key: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=447 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk (actual rows=447 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Sort (actual rows=1341 loops=1) Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=1341 loops=1) - Sort Key: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1341 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_8_chunk_metrics_space_time_idx on _hyper_2_8_chunk (actual rows=1341 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Sort (actual rows=447 loops=1) Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=447 loops=1) - Sort Key: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=447 loops=1) - Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) + -> Index Scan Backward using _hyper_2_9_chunk_metrics_space_time_idx on _hyper_2_9_chunk (actual rows=447 loops=1) + Index Cond: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -> Merge Append (actual rows=1680 loops=1) Sort Key: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id -> Sort (actual rows=336 loops=1) @@ -5816,12 +5602,9 @@ ORDER BY time, -> Sort (actual rows=336 loops=1) Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id Sort Method: quicksort - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) - Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) -(78 rows) + -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) + Filter: ("time" > ('2000-01-08'::cstring)::timestamp with time zone) +(66 rows) -- test aggregate :PREFIX @@ -6180,11 +5963,11 @@ ORDER BY device_id, -> 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._ts_meta_count, compress_hyper_6_17_chunk._ts_meta_sequence_num, compress_hyper_6_17_chunk.device_id, compress_hyper_6_17_chunk.device_id_peer, compress_hyper_6_17_chunk._ts_meta_min_3, compress_hyper_6_17_chunk._ts_meta_max_3, compress_hyper_6_17_chunk."time", compress_hyper_6_17_chunk._ts_meta_min_1, compress_hyper_6_17_chunk._ts_meta_max_1, compress_hyper_6_17_chunk.v0, compress_hyper_6_17_chunk._ts_meta_min_2, compress_hyper_6_17_chunk._ts_meta_max_2, compress_hyper_6_17_chunk.v1, compress_hyper_6_17_chunk.v2, compress_hyper_6_17_chunk.v3 Index Cond: (compress_hyper_6_17_chunk.device_id = 1) - -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=504 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_time_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Sort (actual rows=504 loops=1) + -> Sort (actual rows=336 loops=1) Output: _hyper_2_10_chunk."time", _hyper_2_10_chunk.device_id Sort Key: _hyper_2_10_chunk."time" Sort Method: quicksort @@ -6287,7 +6070,7 @@ ORDER BY device_id; Output: _hyper_2_7_chunk.device_id Index Cond: (_hyper_2_7_chunk.device_id = 1) Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false -> 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) @@ -6353,13 +6136,13 @@ ORDER BY device_id; -> Index Only Scan using _hyper_2_7_chunk_tmp_idx on _timescaledb_internal._hyper_2_7_chunk (actual rows=672 loops=1) Output: _hyper_2_7_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=1512 loops=1) + -> Index Only Scan using _hyper_2_8_chunk_tmp_idx on _timescaledb_internal._hyper_2_8_chunk (actual rows=2016 loops=1) Output: _hyper_2_8_chunk.device_id Heap Fetches: 0 - -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=504 loops=1) + -> Index Only Scan using _hyper_2_9_chunk_tmp_idx on _timescaledb_internal._hyper_2_9_chunk (actual rows=672 loops=1) Output: _hyper_2_9_chunk.device_id Heap Fetches: 0 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=504 loops=1) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 loops=1) Output: _hyper_2_10_chunk.device_id Bulk Decompression: false -> 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) @@ -6889,19 +6672,13 @@ FROM :TEST_TABLE m1 Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) -> Sort (never executed) Sort Key: m1_5."time", m1_5.device_id - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) -> Sort (never executed) Sort Key: m1_6."time", m1_6.device_id - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) -> Merge Append (never executed) Sort Key: m1_7."time", m1_7.device_id -> Sort (never executed) @@ -6914,9 +6691,7 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) -> Materialize (actual rows=10 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=10 loops=1) Order: m2."time", m2.device_id @@ -6941,19 +6716,13 @@ FROM :TEST_TABLE m1 Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) Sort Key: m2_4."time", m2_4.device_id - -> Sort (never executed) - Sort Key: m2_4."time", m2_4.device_id - -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) -> Sort (never executed) Sort Key: m2_5."time", m2_5.device_id - -> Sort (never executed) - Sort Key: m2_5."time", m2_5.device_id - -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) -> Sort (never executed) Sort Key: m2_6."time", m2_6.device_id - -> Sort (never executed) - Sort Key: m2_6."time", m2_6.device_id - -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) -> Merge Append (never executed) Sort Key: m2_7."time", m2_7.device_id -> Sort (never executed) @@ -6966,10 +6735,8 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id - -> Sort (never executed) - Sort Key: m2_9."time", m2_9.device_id - -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) -(106 rows) + -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) +(90 rows) :PREFIX SELECT * @@ -7011,19 +6778,13 @@ FROM :TEST_TABLE m1 Sort Key: m2_4."time", m2_4.device_id -> Sort (never executed) Sort Key: m2_4."time", m2_4.device_id - -> Sort (never executed) - Sort Key: m2_4."time", m2_4.device_id - -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m2_4 (never executed) -> Sort (never executed) Sort Key: m2_5."time", m2_5.device_id - -> Sort (never executed) - Sort Key: m2_5."time", m2_5.device_id - -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m2_5 (never executed) -> Sort (never executed) Sort Key: m2_6."time", m2_6.device_id - -> Sort (never executed) - Sort Key: m2_6."time", m2_6.device_id - -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m2_6 (never executed) -> Merge Append (never executed) Sort Key: m2_7."time", m2_7.device_id -> Sort (never executed) @@ -7036,9 +6797,7 @@ FROM :TEST_TABLE m1 -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_9."time", m2_9.device_id - -> Sort (never executed) - Sort Key: m2_9."time", m2_9.device_id - -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m2_9 (never executed) -> Materialize (actual rows=49 loops=1) -> Nested Loop (actual rows=11 loops=1) Join Filter: (m1_1."time" = m3_1."time") @@ -7071,7 +6830,7 @@ FROM :TEST_TABLE m1 -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m1_8 (actual rows=1008 loops=1) -> Seq Scan on compress_hyper_6_21_chunk (actual rows=3 loops=1) -> Seq Scan on _hyper_2_12_chunk m1_9 (actual rows=336 loops=1) -(88 rows) +(80 rows) :PREFIX SELECT * @@ -7213,19 +6972,13 @@ LIMIT 10; Sort Key: m1_4."time", m1_4.device_id -> Sort (never executed) Sort Key: m1_4."time", m1_4.device_id - -> Sort (never executed) - Sort Key: m1_4."time", m1_4.device_id - -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) + -> Seq Scan on _hyper_2_7_chunk m1_4 (never executed) -> Sort (never executed) Sort Key: m1_5."time", m1_5.device_id - -> Sort (never executed) - Sort Key: m1_5."time", m1_5.device_id - -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) + -> Seq Scan on _hyper_2_8_chunk m1_5 (never executed) -> Sort (never executed) Sort Key: m1_6."time", m1_6.device_id - -> Sort (never executed) - Sort Key: m1_6."time", m1_6.device_id - -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) + -> Seq Scan on _hyper_2_9_chunk m1_6 (never executed) -> Merge Append (never executed) Sort Key: m1_7."time", m1_7.device_id -> Sort (never executed) @@ -7238,9 +6991,7 @@ LIMIT 10; -> Seq Scan on compress_hyper_6_21_chunk (never executed) -> Sort (never executed) Sort Key: m1_9."time", m1_9.device_id - -> Sort (never executed) - Sort Key: m1_9."time", m1_9.device_id - -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) + -> Seq Scan on _hyper_2_12_chunk m1_9 (never executed) -> Materialize (actual rows=49 loops=1) -> Custom Scan (ChunkAppend) on metrics_space m2 (actual rows=11 loops=1) Order: m2."time" @@ -7249,27 +7000,18 @@ LIMIT 10; -> Sort (actual rows=3 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=1 loops=1) -> Sort (actual rows=7 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=2160 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=2160 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=3 loops=1) -> Sort (actual rows=3 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=1 loops=1) -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7279,18 +7021,14 @@ LIMIT 10; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) -(105 rows) +(84 rows) :PREFIX SELECT * @@ -7357,33 +7095,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk compress_hyper_6_17_chunk_1 (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=22 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk compress_hyper_6_18_chunk_1 (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk compress_hyper_6_19_chunk_1 (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7396,21 +7125,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk compress_hyper_6_20_chunk_1 (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk compress_hyper_6_21_chunk_1 (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) Filter: (device_id = 2) -(105 rows) +(92 rows) :PREFIX SELECT * @@ -7456,33 +7181,24 @@ LIMIT 100; -> Sort (actual rows=0 loops=1) Sort Key: m2_1."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_1."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk m2_1 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_17_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Sort (actual rows=21 loops=1) Sort Key: m2_2."time" Sort Method: quicksort - -> Sort (actual rows=720 loops=1) - Sort Key: m2_2."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) - -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 2 + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk m2_2 (actual rows=720 loops=1) + -> Seq Scan on compress_hyper_6_18_chunk (actual rows=1 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 2 -> Sort (actual rows=0 loops=1) Sort Key: m2_3."time" Sort Method: quicksort - -> Sort (actual rows=0 loops=1) - Sort Key: m2_3."time" - Sort Method: quicksort - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) - -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) - Filter: (device_id = 2) - Rows Removed by Filter: 1 + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk m2_3 (actual rows=0 loops=1) + -> Seq Scan on compress_hyper_6_19_chunk (actual rows=0 loops=1) + Filter: (device_id = 2) + Rows Removed by Filter: 1 -> Merge Append (never executed) Sort Key: m2_4."time" -> Index Scan Backward using _hyper_2_7_chunk_metrics_space_time_idx on _hyper_2_7_chunk m2_4 (never executed) @@ -7495,21 +7211,17 @@ LIMIT 100; Sort Key: m2_7."time" -> Sort (never executed) Sort Key: m2_7."time" - -> Sort (never executed) - Sort Key: m2_7."time" - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) - -> Seq Scan on compress_hyper_6_20_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk m2_7 (never executed) + -> Seq Scan on compress_hyper_6_20_chunk (never executed) + Filter: (device_id = 2) -> Sort (never executed) Sort Key: m2_8."time" - -> Sort (never executed) - Sort Key: m2_8."time" - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) - -> Seq Scan on compress_hyper_6_21_chunk (never executed) - Filter: (device_id = 2) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk m2_8 (never executed) + -> Seq Scan on compress_hyper_6_21_chunk (never executed) + Filter: (device_id = 2) -> Index Scan Backward using _hyper_2_12_chunk_metrics_space_time_idx on _hyper_2_12_chunk m2_9 (never executed) Filter: (device_id = 2) -(84 rows) +(71 rows) -- test implicit self-join :PREFIX From 8a3c167d75cd0a2619519f2053d39090248606ab Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:20:02 +0200 Subject: [PATCH 060/157] benchmark double sort (2024-06-04 no. 1) From 842e044083d145867351753764d8e3c07661e625 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:22:06 +0200 Subject: [PATCH 061/157] cleanup --- src/nodes/chunk_append/planner.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index c2609d6250c..30f694557c4 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -87,14 +87,10 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List /* inject sort node if child sort order does not match desired order */ if (!pathkeys_contained_in(pathkeys, path->pathkeys)) { - Plan *child = plan; - if (IsA(plan, Sort)) - { - child = plan->lefttree; - } + Assert(!IsA(plan, Sort)); plan = (Plan *) - make_sort(child, childSortCols, childColIdx, sortOperators, collations, nullsFirst); + make_sort(plan, childSortCols, childColIdx, sortOperators, collations, nullsFirst); } return plan; } From 30f5201456a8c303ef047947e25a2ff6b3889de5 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 4 Jun 2024 17:17:28 +0200 Subject: [PATCH 062/157] benchmark double sort (2024-06-04 no. 2) From dba8293e39a9e3e4cdbe8cb3bbb3851d2b5dee0c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 5 Jun 2024 17:16:07 +0200 Subject: [PATCH 063/157] tmp wrong[: --- src/import/planner.c | 7 +-- .../nodes/decompress_chunk/decompress_chunk.c | 61 +++++++++---------- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/import/planner.c b/src/import/planner.c index 9e090bc735f..82bcfd695fb 100644 --- a/src/import/planner.c +++ b/src/import/planner.c @@ -387,10 +387,9 @@ ts_make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOpera node->collations = collations; node->nullsFirst = nullsFirst; - fprintf(stderr, "ts make sort\n"); - mybt(); - my_print(node); - +// fprintf(stderr, "ts make sort\n"); +// mybt(); +// my_print(node); return node; } diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 41ac8c065d8..6ea8873b043 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -4,9 +4,9 @@ * LICENSE-TIMESCALE for a copy of the license. */ -#include #include #include +#include #include #include #include @@ -25,17 +25,17 @@ #include #include "compat/compat.h" +#include "compression/compression.h" +#include "compression/create.h" #include "cross_module_fn.h" #include "custom_type_cache.h" #include "debug_assert.h" -#include "ts_catalog/array_utils.h" -#include "import/planner.h" #include "import/allpaths.h" -#include "compression/create.h" -#include "compression/compression.h" +#include "import/planner.h" #include "nodes/decompress_chunk/decompress_chunk.h" #include "nodes/decompress_chunk/planner.h" #include "nodes/decompress_chunk/qual_pushdown.h" +#include "ts_catalog/array_utils.h" #include "utils.h" static CustomPathMethods decompress_chunk_path_methods = { @@ -394,11 +394,8 @@ cost_batch_sorted_merge(PlannerInfo *root, CompressionInfo *compression_info, .varattno = compressed_attno }; segmentby_groupexprs = lappend(segmentby_groupexprs, var); } - const double open_batches_estimated = estimate_num_groups_compat(root, - segmentby_groupexprs, - dcpath->custom_path.path.rows, - NULL, - NULL); + const double open_batches_estimated = + estimate_num_groups(root, segmentby_groupexprs, dcpath->custom_path.path.rows, NULL, NULL); Assert(open_batches_estimated > 0); /* @@ -701,8 +698,8 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Hypertable *ht, Path *sorted_path = (Path *) create_sort_path(root, chunk_rel, (Path *) path_copy, useful_pathkeys, root->limit_tuples); -// fprintf(stderr, "made useful sorted path:\n"); -// my_print(sorted_path); + // fprintf(stderr, "made useful sorted path:\n"); + // my_print(sorted_path); return sorted_path; } @@ -1036,16 +1033,15 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp * MergeAppend paths if some child paths have pathkeys, so * here it is enough to create a plain Append path. */ - path = (Path *) create_append_path_compat(root, - chunk_rel, - list_make2(path, uncompressed_path), - NIL /* partial paths */, - NIL, // path->pathkeys, - req_outer, - 0, - false, - false, - path->rows + uncompressed_path->rows); + path = (Path *) create_append_path(root, + chunk_rel, + list_make2(path, uncompressed_path), + NIL /* partial paths */, + NIL, // path->pathkeys, + req_outer, + 0, + false, + path->rows + uncompressed_path->rows); add_path(chunk_rel, path); } } @@ -1124,17 +1120,16 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp path_list = list_make1(uncompressed_path); /* Use a parallel aware append to handle non-partial paths properly */ - path = (Path *) create_append_path_compat(root, - chunk_rel, - path_list, - partial_path_list, - NIL /* pathkeys */, - req_outer, - Max(path->parallel_workers, - uncompressed_path->parallel_workers), - true, /* parallel aware */ - NIL, - path->rows + uncompressed_path->rows); + path = (Path *) create_append_path(root, + chunk_rel, + path_list, + partial_path_list, + NIL /* pathkeys */, + req_outer, + Max(path->parallel_workers, + uncompressed_path->parallel_workers), + true, /* parallel aware */ + path->rows + uncompressed_path->rows); } add_partial_path(chunk_rel, path); From 0039a6f6f2d7d4d292b09cd14481fde1817c183c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 12 Jun 2024 12:02:04 +0200 Subject: [PATCH 064/157] temp debug --- tsl/src/nodes/decompress_chunk/decompress_chunk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 6ea8873b043..dc1af24e9cc 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -780,6 +780,10 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp chunk_rel->rows = new_row_estimate; create_compressed_scan_paths(root, compressed_rel, compression_info, &sort_info); + fprintf(stderr, "sortinfo: seqnum %d, pushdown %d, reverse %d, compressed pks:\n", + sort_info.needs_sequence_num, sort_info.can_pushdown_sort, + sort_info.reverse); + my_print(sort_info.required_compressed_pathkeys); /* compute parent relids of the chunk and use it to filter paths*/ Relids parent_relids = NULL; @@ -1033,6 +1037,8 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp * MergeAppend paths if some child paths have pathkeys, so * here it is enough to create a plain Append path. */ + if (path->pathkeys == NIL) + { path = (Path *) create_append_path(root, chunk_rel, list_make2(path, uncompressed_path), @@ -1042,6 +1048,13 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, Hyp 0, false, path->rows + uncompressed_path->rows); + } + else + { + path = (Path *) create_merge_append_path(root, chunk_rel, + list_make2(path, uncompressed_path), path->pathkeys, + req_outer); + } add_path(chunk_rel, path); } } From 8b81b42561fedc32458b98e3353b10a4168e46d3 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 12 Jun 2024 12:53:55 +0200 Subject: [PATCH 065/157] small fix --- src/planner/partialize.c | 14 +- tsl/src/nodes/vector_agg/plan.c | 10 ++ .../merge_append_partially_compressed-15.out | 136 +++++++----------- 3 files changed, 76 insertions(+), 84 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index ea13257d904..9bcc2af71ed 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -527,6 +527,11 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI } } + fprintf(stderr, "have the following sorted subpaths:\n"); + mybt(); + my_print(sorted_subpaths); + + /* Create new append paths */ if (sorted_subpaths != NIL) { @@ -658,7 +663,10 @@ get_best_total_path(RelOptInfo *output_rel) Path *path = lfirst(lc); if (ts_is_chunk_append_path(path)) + { + fprintf(stderr, "we preferred chunk append\n"); return path; + } } return output_rel->cheapest_total_path; @@ -818,8 +826,12 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel } /* Generate the aggregation pushdown path */ - Path *cheapest_total_path = get_best_total_path(input_rel); + (void) get_best_total_path; + //Path *cheapest_total_path = get_best_total_path(input_rel); + Path *cheapest_total_path = existing_agg_path->subpath; Assert(cheapest_total_path != NULL); + fprintf(stderr, "cheapest total path at partial agg entry point is:\n"); + my_print(cheapest_total_path); generate_agg_pushdown_path(root, cheapest_total_path, output_rel, diff --git a/tsl/src/nodes/vector_agg/plan.c b/tsl/src/nodes/vector_agg/plan.c index f6e6c81f432..51bc361b714 100644 --- a/tsl/src/nodes/vector_agg/plan.c +++ b/tsl/src/nodes/vector_agg/plan.c @@ -213,6 +213,16 @@ try_insert_vector_agg_node(Plan *plan) return plan; } + if (agg->aggstrategy != AGG_PLAIN && agg->aggstrategy != AGG_HASHED) + { + /* + * The sorted grouping produces sorted output, and the above plan nodes + * might rely on that. Vectorized aggregation uses hashing and cannot + * provide sorted output. + */ + return plan; + } + if (agg->plan.lefttree == NULL) { /* diff --git a/tsl/test/expected/merge_append_partially_compressed-15.out b/tsl/test/expected/merge_append_partially_compressed-15.out index 9ee91829636..bf6dc6ada5e 100644 --- a/tsl/test/expected/merge_append_partially_compressed-15.out +++ b/tsl/test/expected/merge_append_partially_compressed-15.out @@ -76,39 +76,25 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Merge Append (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=81 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) - -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=84 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) - -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) -(33 rows) + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) +(19 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -148,48 +134,32 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',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: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC - -> Merge Append (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Result (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Result (never executed) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) - -> Seq Scan on compress_hyper_2_5_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Seq Scan on _hyper_1_2_chunk (never executed) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Result (never executed) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) - -> Seq Scan on compress_hyper_2_4_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Seq Scan on _hyper_1_1_chunk (never executed) -(35 rows) + Sort Method: top-N heapsort + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) +(19 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,8 +170,8 @@ 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_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[])) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort @@ -213,8 +183,8 @@ 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_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -225,8 +195,8 @@ 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_device__ts_meta_sequence_num_idx on compress_hyper_2_4_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC -> Seq Scan on _hyper_1_1_chunk (never executed) @@ -234,8 +204,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,8 +216,8 @@ 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_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[])) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + Filter: (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 Sort Method: top-N heapsort @@ -259,8 +229,8 @@ 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_device__ts_meta_sequence_num_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -271,8 +241,8 @@ 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_device__ts_meta_sequence_num_idx on compress_hyper_2_6_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Seq Scan on _hyper_1_3_chunk (never executed) From 20ff42b49886cfb5e95db7091d115c2eaabd5dff Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:00:21 +0200 Subject: [PATCH 066/157] Choose cheapest aggregated path as base for chunk-wise aggregation Currently we use the cheapest path before final aggregation for this (i.e. Append over individual chunks), but it does not consider the cost of a Sort that might be required before aggregation. To account for this, use instead the child path of the cheapest final aggregated path. --- src/planner/partialize.c | 6 +- tsl/src/nodes/vector_agg/plan.c | 10 + tsl/test/expected/vectorized_aggregation.out | 252 ++++++++++--------- 3 files changed, 144 insertions(+), 124 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index ea13257d904..c50204c2187 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -818,8 +818,12 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel } /* Generate the aggregation pushdown path */ - Path *cheapest_total_path = get_best_total_path(input_rel); + (void) get_best_total_path; + //Path *cheapest_total_path = get_best_total_path(input_rel); + Path *cheapest_total_path = existing_agg_path->subpath; Assert(cheapest_total_path != NULL); +// fprintf(stderr, "cheapest total path at partial agg entry point is:\n"); +// my_print(cheapest_total_path); generate_agg_pushdown_path(root, cheapest_total_path, output_rel, diff --git a/tsl/src/nodes/vector_agg/plan.c b/tsl/src/nodes/vector_agg/plan.c index f6e6c81f432..51bc361b714 100644 --- a/tsl/src/nodes/vector_agg/plan.c +++ b/tsl/src/nodes/vector_agg/plan.c @@ -213,6 +213,16 @@ try_insert_vector_agg_node(Plan *plan) return plan; } + if (agg->aggstrategy != AGG_PLAIN && agg->aggstrategy != AGG_HASHED) + { + /* + * The sorted grouping produces sorted output, and the above plan nodes + * might rely on that. Vectorized aggregation uses hashing and cannot + * provide sorted output. + */ + return plan; + } + if (agg->plan.lefttree == NULL) { /* diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 87a9df6a150..5de9b0b1fe8 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -108,137 +108,143 @@ SELECT sum(segment_by_value) FROM testtable; -- Vectorization possible - filter on segment_by :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> 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._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> 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._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> 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._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: (_hyper_1_4_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: (_hyper_1_5_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: (_hyper_1_6_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: (_hyper_1_7_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: (_hyper_1_8_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: (_hyper_1_9_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: (_hyper_1_10_chunk.segment_by_value > 0) -(59 rows) + -> Gather + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Workers Planned: 2 + -> Parallel Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: (_hyper_1_4_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: (_hyper_1_5_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: (_hyper_1_6_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: (_hyper_1_7_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: (_hyper_1_8_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: (_hyper_1_9_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: (_hyper_1_10_chunk.segment_by_value > 0) +(62 rows) -- Vectorization not possible due to a used filter :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_value > 0; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - -> 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_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - -> 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_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - -> 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_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) -(62 rows) + -> Gather + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Workers Planned: 2 + -> Parallel Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) +(65 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE int_value > 0; From f9508a3970f072c1a66c6d4e1e1bbeee42de88c0 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:32:21 +0200 Subject: [PATCH 067/157] test refs --- test/expected/partitionwise-15.out | 80 +++---- test/expected/sql_query.out | 53 ++--- tsl/test/expected/agg_partials_pushdown.out | 134 +++++------ .../expected/transparent_decompression-15.out | 216 ++++++++---------- 4 files changed, 221 insertions(+), 262 deletions(-) diff --git a/test/expected/partitionwise-15.out b/test/expected/partitionwise-15.out index ea178ed5813..05d260808a6 100644 --- a/test/expected/partitionwise-15.out +++ b/test/expected/partitionwise-15.out @@ -402,56 +402,36 @@ SELECT time, device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ - Finalize GroupAggregate - Output: hyper."time", hyper.device, avg(hyper.temp) - Group Key: hyper."time", hyper.device - -> Sort - Output: hyper."time", hyper.device, (PARTIAL avg(hyper.temp)) - Sort Key: hyper."time", hyper.device - -> Custom Scan (ChunkAppend) on public.hyper - Output: hyper."time", hyper.device, (PARTIAL avg(hyper.temp)) - Order: hyper."time" - Startup Exclusion: false - Runtime Exclusion: false - -> Merge Append - Sort Key: _hyper_1_1_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Sort - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Index Scan Backward using _hyper_1_1_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Sort - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Index Scan Backward using _hyper_1_2_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Merge Append - Sort Key: _hyper_1_3_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Sort - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Index Scan Backward using _hyper_1_3_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Sort - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp - Sort Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Index Scan Backward using _hyper_1_4_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(47 rows) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Sort + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Finalize HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Partial aggregation since date_trunc(time) is not a partition key SET enable_partitionwise_aggregate = 'off'; diff --git a/test/expected/sql_query.out b/test/expected/sql_query.out index 4adff1be1f8..80e41bd9907 100644 --- a/test/expected/sql_query.out +++ b/test/expected/sql_query.out @@ -220,41 +220,38 @@ EXPLAIN (verbose ON, costs off)SELECT * FROM PUBLIC."two_Partitions" WHERE serie --note that without time transform things work too EXPLAIN (verbose ON, costs off)SELECT "timeCustom" t, min(series_0) FROM PUBLIC."two_Partitions" GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------- Limit - Output: "two_Partitions"."timeCustom", (min("two_Partitions".series_0)) - -> Finalize GroupAggregate - Output: "two_Partitions"."timeCustom", min("two_Partitions".series_0) - Group Key: "two_Partitions"."timeCustom" - -> Custom Scan (ChunkAppend) on public."two_Partitions" - Output: "two_Partitions"."timeCustom", (PARTIAL min("two_Partitions".series_0)) - Order: "two_Partitions"."timeCustom" DESC NULLS LAST - Startup Exclusion: false - Runtime Exclusion: false - -> Partial GroupAggregate - Output: _hyper_1_3_chunk."timeCustom", PARTIAL min(_hyper_1_3_chunk.series_0) - Group Key: _hyper_1_3_chunk."timeCustom" - -> Index Scan using "_hyper_1_3_chunk_two_Partitions_timeCustom_device_id_idx" on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."timeCustom", _hyper_1_3_chunk.series_0 - -> Partial GroupAggregate - Output: _hyper_1_2_chunk."timeCustom", PARTIAL min(_hyper_1_2_chunk.series_0) - Group Key: _hyper_1_2_chunk."timeCustom" - -> Index Scan using "_hyper_1_2_chunk_two_Partitions_timeCustom_device_id_idx" on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."timeCustom", _hyper_1_2_chunk.series_0 - -> Merge Append - Sort Key: _hyper_1_4_chunk."timeCustom" DESC NULLS LAST - -> Partial GroupAggregate + Output: _hyper_1_3_chunk."timeCustom", (min(_hyper_1_3_chunk.series_0)) + -> Sort + Output: _hyper_1_3_chunk."timeCustom", (min(_hyper_1_3_chunk.series_0)) + Sort Key: _hyper_1_3_chunk."timeCustom" DESC NULLS LAST + -> Finalize HashAggregate + Output: _hyper_1_3_chunk."timeCustom", min(_hyper_1_3_chunk.series_0) + Group Key: _hyper_1_3_chunk."timeCustom" + -> Append + -> Partial HashAggregate + Output: _hyper_1_3_chunk."timeCustom", PARTIAL min(_hyper_1_3_chunk.series_0) + Group Key: _hyper_1_3_chunk."timeCustom" + -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk."timeCustom", _hyper_1_3_chunk.series_0 + -> Partial HashAggregate + Output: _hyper_1_2_chunk."timeCustom", PARTIAL min(_hyper_1_2_chunk.series_0) + Group Key: _hyper_1_2_chunk."timeCustom" + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk."timeCustom", _hyper_1_2_chunk.series_0 + -> Partial HashAggregate Output: _hyper_1_4_chunk."timeCustom", PARTIAL min(_hyper_1_4_chunk.series_0) Group Key: _hyper_1_4_chunk."timeCustom" - -> Index Scan using "_hyper_1_4_chunk_two_Partitions_timeCustom_device_id_idx" on _timescaledb_internal._hyper_1_4_chunk + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk Output: _hyper_1_4_chunk."timeCustom", _hyper_1_4_chunk.series_0 - -> Partial GroupAggregate + -> Partial HashAggregate Output: _hyper_1_1_chunk."timeCustom", PARTIAL min(_hyper_1_1_chunk.series_0) Group Key: _hyper_1_1_chunk."timeCustom" - -> Index Scan using "_hyper_1_1_chunk_two_Partitions_timeCustom_device_id_idx" on _timescaledb_internal._hyper_1_1_chunk + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk."timeCustom", _hyper_1_1_chunk.series_0 -(32 rows) +(29 rows) --The query should still use the index on timeCustom, even though the GROUP BY/ORDER BY is on the transformed time 't'. --However, current query plans show that it does not. diff --git a/tsl/test/expected/agg_partials_pushdown.out b/tsl/test/expected/agg_partials_pushdown.out index d716dbc7dd5..da0004aec6d 100644 --- a/tsl/test/expected/agg_partials_pushdown.out +++ b/tsl/test/expected/agg_partials_pushdown.out @@ -322,41 +322,44 @@ SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t :PREFIX SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------- Limit (actual rows=2 loops=1) - Output: testtable2.timecustom, (min(testtable2.series_0)) - -> Finalize GroupAggregate (actual rows=2 loops=1) - Output: testtable2.timecustom, min(testtable2.series_0) - Group Key: testtable2.timecustom - -> Custom Scan (ChunkAppend) on public.testtable2 (actual rows=3 loops=1) - Output: testtable2.timecustom, (PARTIAL min(testtable2.series_0)) - Order: testtable2.timecustom DESC NULLS LAST - Startup Exclusion: false - Runtime Exclusion: false - -> Partial GroupAggregate (actual rows=1 loops=1) - Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) - Group Key: _hyper_3_7_chunk.timecustom - -> Index Scan using _hyper_3_7_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 - -> Partial GroupAggregate (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) - Group Key: _hyper_3_6_chunk.timecustom - -> Index Scan using _hyper_3_6_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 - -> Merge Append (actual rows=1 loops=1) - Sort Key: _hyper_3_8_chunk.timecustom DESC NULLS LAST - -> Partial GroupAggregate (actual rows=1 loops=1) + Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) + -> Sort (actual rows=2 loops=1) + Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) + Sort Key: _hyper_3_7_chunk.timecustom DESC NULLS LAST + Sort Method: top-N heapsort + -> Finalize HashAggregate (actual rows=6 loops=1) + Output: _hyper_3_7_chunk.timecustom, min(_hyper_3_7_chunk.series_0) + Group Key: _hyper_3_7_chunk.timecustom + Batches: 1 + -> Append (actual rows=7 loops=1) + -> Partial HashAggregate (actual rows=1 loops=1) + Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) + Group Key: _hyper_3_7_chunk.timecustom + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) + Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 + -> Partial HashAggregate (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) + Group Key: _hyper_3_6_chunk.timecustom + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 + -> Partial HashAggregate (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, PARTIAL min(_hyper_3_8_chunk.series_0) Group Key: _hyper_3_8_chunk.timecustom - -> Index Scan using _hyper_3_8_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, _hyper_3_8_chunk.series_0 - -> Partial GroupAggregate (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=4 loops=1) Output: _hyper_3_5_chunk.timecustom, PARTIAL min(_hyper_3_5_chunk.series_0) Group Key: _hyper_3_5_chunk.timecustom - -> Index Scan using _hyper_3_5_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_5_chunk (actual rows=4 loops=1) + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_5_chunk (actual rows=7 loops=1) Output: _hyper_3_5_chunk.timecustom, _hyper_3_5_chunk.series_0 -(32 rows) +(35 rows) -- Force parallel query SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false); @@ -376,58 +379,61 @@ SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t :PREFIX SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- Gather (actual rows=2 loops=1) - Output: testtable2.timecustom, (min(testtable2.series_0)) + Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) Workers Planned: 1 Workers Launched: 1 Single Copy: true -> Limit (actual rows=2 loops=1) - Output: testtable2.timecustom, (min(testtable2.series_0)) + Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) Worker 0: actual rows=2 loops=1 - -> Finalize GroupAggregate (actual rows=2 loops=1) - Output: testtable2.timecustom, min(testtable2.series_0) - Group Key: testtable2.timecustom + -> Sort (actual rows=2 loops=1) + Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) + Sort Key: _hyper_3_7_chunk.timecustom DESC NULLS LAST Worker 0: actual rows=2 loops=1 - -> Custom Scan (ChunkAppend) on public.testtable2 (actual rows=3 loops=1) - Output: testtable2.timecustom, (PARTIAL min(testtable2.series_0)) - Order: testtable2.timecustom DESC NULLS LAST - Startup Exclusion: false - Runtime Exclusion: false - Worker 0: actual rows=3 loops=1 - -> Partial GroupAggregate (actual rows=1 loops=1) - Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) - Group Key: _hyper_3_7_chunk.timecustom - Worker 0: actual rows=1 loops=1 - -> Index Scan using _hyper_3_7_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 - Worker 0: actual rows=2 loops=1 - -> Partial GroupAggregate (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) - Group Key: _hyper_3_6_chunk.timecustom - Worker 0: actual rows=1 loops=1 - -> Index Scan using _hyper_3_6_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 + Sort Method: top-N heapsort + -> Finalize HashAggregate (actual rows=6 loops=1) + Output: _hyper_3_7_chunk.timecustom, min(_hyper_3_7_chunk.series_0) + Group Key: _hyper_3_7_chunk.timecustom + Worker 0: actual rows=6 loops=1 + Batches: 1 + -> Append (actual rows=7 loops=1) + Worker 0: actual rows=7 loops=1 + -> Partial HashAggregate (actual rows=1 loops=1) + Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) + Group Key: _hyper_3_7_chunk.timecustom Worker 0: actual rows=1 loops=1 - -> Merge Append (actual rows=1 loops=1) - Sort Key: _hyper_3_8_chunk.timecustom DESC NULLS LAST - Worker 0: actual rows=1 loops=1 - -> Partial GroupAggregate (actual rows=1 loops=1) + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) + Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 + Worker 0: actual rows=2 loops=1 + -> Partial HashAggregate (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) + Group Key: _hyper_3_6_chunk.timecustom + Worker 0: actual rows=1 loops=1 + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 + Worker 0: actual rows=1 loops=1 + -> Partial HashAggregate (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, PARTIAL min(_hyper_3_8_chunk.series_0) Group Key: _hyper_3_8_chunk.timecustom Worker 0: actual rows=1 loops=1 - -> Index Scan using _hyper_3_8_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, _hyper_3_8_chunk.series_0 Worker 0: actual rows=1 loops=1 - -> Partial GroupAggregate (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=4 loops=1) Output: _hyper_3_5_chunk.timecustom, PARTIAL min(_hyper_3_5_chunk.series_0) Group Key: _hyper_3_5_chunk.timecustom - Worker 0: actual rows=1 loops=1 - -> Index Scan using _hyper_3_5_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_5_chunk (actual rows=4 loops=1) + Worker 0: actual rows=4 loops=1 + Batches: 1 + -> Seq Scan on _timescaledb_internal._hyper_3_5_chunk (actual rows=7 loops=1) Output: _hyper_3_5_chunk.timecustom, _hyper_3_5_chunk.series_0 - Worker 0: actual rows=4 loops=1 -(49 rows) + Worker 0: actual rows=7 loops=1 +(52 rows) -- Test that we don't process groupingSets :PREFIX diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index ba2e2c5ec33..8e5bddb6857 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1647,14 +1647,41 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_3_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(18 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) @@ -1669,38 +1696,7 @@ ORDER BY device_id; Group Key: _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(20 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(21 rows) +(19 rows) SET enable_hashagg = ON; -- test CTE @@ -5812,14 +5808,63 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_5_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_6_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_10_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_11_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(40 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) @@ -5834,22 +5879,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) @@ -5860,72 +5899,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(50 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(51 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(41 rows) SET enable_hashagg = ON; -- test CTE From 2516cec461de98ba49875696c4e2352e04f410cb Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:51:11 +0200 Subject: [PATCH 068/157] cleanup after merge --- .../nodes/decompress_chunk/decompress_chunk.c | 26 +++--- tsl/src/nodes/decompress_chunk/planner.c | 1 + .../expected/transparent_decompression-15.out | 81 +++++++++---------- tsl/test/sql/CMakeLists.txt | 1 - 4 files changed, 49 insertions(+), 60 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index dc1af24e9cc..499a0388f53 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -1545,17 +1545,6 @@ add_segmentby_to_equivalence_class(PlannerInfo *root, EquivalenceClass *cur_ec, Var *var; Assert(!bms_overlap(cur_em->em_relids, info->compressed_rel->relids)); - /* - * We want to base our equivalence member on the hypertable equivalence - * member, not on the uncompressed chunk one, because the latter is - * marked as child itself. This is mostly relevant for PG16 where we - * have to specify a parent for the newly created equivalence member. - */ - if (cur_em->em_is_child) - { - continue; - } - /* only consider EquivalenceMembers that are Vars, possibly with RelabelType, of the * uncompressed chunk */ var = (Var *) cur_em->em_expr; @@ -1564,6 +1553,13 @@ add_segmentby_to_equivalence_class(PlannerInfo *root, EquivalenceClass *cur_ec, if (!(var && IsA(var, Var))) continue; + /* + * We want to base our equivalence member on the hypertable equivalence + * member, not on the uncompressed chunk one. We can't just check for + * em_is_child though because the hypertable might be a child itself and not + * a top-level EquivalenceMember. This is mostly relevant for PG16+ where + * we have to specify a parent for the newly created equivalence member. + */ if ((Index) var->varno != info->ht_rel->relid) continue; @@ -1863,10 +1859,10 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, Comp { /* Almost the same functionality as ts_create_plain_partial_paths. * - * However, we also create a partial path for small chunks to allow PostgreSQL to choose a - * parallel plan for decompression. If no partial path is present for a single chunk, - * PostgreSQL will not use a parallel plan and all chunks are decompressed by a non-parallel - * plan (even if there are a few bigger chunks). + * However, we also create a partial path for small chunks to allow PostgreSQL to choose + * a parallel plan for decompression. If no partial path is present for a single chunk, + * PostgreSQL will not use a parallel plan and all chunks are decompressed by a + * non-parallel plan (even if there are a few bigger chunks). */ int parallel_workers = compute_parallel_worker(compressed_rel, compressed_rel->pages, diff --git a/tsl/src/nodes/decompress_chunk/planner.c b/tsl/src/nodes/decompress_chunk/planner.c index f557d27d1b9..e9ded8dfc35 100644 --- a/tsl/src/nodes/decompress_chunk/planner.c +++ b/tsl/src/nodes/decompress_chunk/planner.c @@ -1067,6 +1067,7 @@ decompress_chunk_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *pat /* Build heap sort info for batch sorted merge. */ List *sort_options = NIL; + if (dcpath->batch_sorted_merge) { /* diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 5f3ad6ec0f2..404e8198329 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1510,28 +1510,23 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=2235 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 - Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Rows Removed by Filter: 1125 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 - Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, compress_hyper_5_16_chunk._ts_meta_sequence_num - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 + Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk._ts_meta_sequence_num, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- should not produce ordered path :PREFIX_VERBOSE @@ -5399,43 +5394,41 @@ ORDER BY device_id DESC, time; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=447 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 - Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, compress_hyper_6_20_chunk._ts_meta_sequence_num - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 + Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk._ts_meta_sequence_num, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1008 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 - -> Sort (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, compress_hyper_6_21_chunk._ts_meta_sequence_num - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk._ts_meta_sequence_num, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(36 rows) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(34 rows) -- should not produce ordered path :PREFIX_VERBOSE diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index fba3332aed8..3320af7fddd 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -134,7 +134,6 @@ set(SOLO_TESTS cagg_invalidation move reorder - transparent_decompression-${PG_VERSION_MAJOR} telemetry_stats) set(TEST_TEMPLATES From 769a346931f6ea2aeaa7eb34d6206f3d8bf92272 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 17 Jun 2024 12:27:38 +0200 Subject: [PATCH 069/157] reference REL_16_3 transparent_decompression-* partitionwise-* --- test/expected/partitionwise-16.out | 80 +++---- .../expected/transparent_decompression-16.out | 216 ++++++++---------- 2 files changed, 126 insertions(+), 170 deletions(-) diff --git a/test/expected/partitionwise-16.out b/test/expected/partitionwise-16.out index 831f84d0e79..691cbcc11d9 100644 --- a/test/expected/partitionwise-16.out +++ b/test/expected/partitionwise-16.out @@ -402,56 +402,36 @@ SELECT time, device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ - Finalize GroupAggregate - Output: hyper."time", hyper.device, avg(hyper.temp) - Group Key: hyper."time", hyper.device - -> Sort - Output: hyper."time", hyper.device, (PARTIAL avg(hyper.temp)) - Sort Key: hyper."time", hyper.device - -> Custom Scan (ChunkAppend) on public.hyper - Output: hyper."time", hyper.device, (PARTIAL avg(hyper.temp)) - Order: hyper."time" - Startup Exclusion: false - Runtime Exclusion: false - -> Merge Append - Sort Key: _hyper_1_1_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Sort - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Index Scan Backward using _hyper_1_1_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Sort - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Index Scan Backward using _hyper_1_2_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Merge Append - Sort Key: _hyper_1_3_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Sort - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Index Scan Backward using _hyper_1_3_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Sort - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp - Sort Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Index Scan Backward using _hyper_1_4_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(47 rows) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Sort + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Finalize HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Partial aggregation since date_trunc(time) is not a partition key SET enable_partitionwise_aggregate = 'off'; diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index d6d583e1634..2550f9381b4 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -1647,14 +1647,41 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_3_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(18 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) @@ -1669,38 +1696,7 @@ ORDER BY device_id; Group Key: _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(20 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(21 rows) +(19 rows) SET enable_hashagg = ON; -- test CTE @@ -5647,14 +5643,63 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_5_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_6_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_10_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_11_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(40 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) @@ -5669,22 +5714,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) @@ -5695,72 +5734,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(50 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(51 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(41 rows) SET enable_hashagg = ON; -- test CTE From 5fe7c522a9e6a3578bbe63d71edfd85e4c693843 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 17 Jun 2024 12:29:30 +0200 Subject: [PATCH 070/157] reference REL_14_11 transparent_decompression-* partitionwise-* --- test/expected/partitionwise-14.out | 80 +++---- .../expected/transparent_decompression-14.out | 216 ++++++++---------- 2 files changed, 126 insertions(+), 170 deletions(-) diff --git a/test/expected/partitionwise-14.out b/test/expected/partitionwise-14.out index ea178ed5813..05d260808a6 100644 --- a/test/expected/partitionwise-14.out +++ b/test/expected/partitionwise-14.out @@ -402,56 +402,36 @@ SELECT time, device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ - Finalize GroupAggregate - Output: hyper."time", hyper.device, avg(hyper.temp) - Group Key: hyper."time", hyper.device - -> Sort - Output: hyper."time", hyper.device, (PARTIAL avg(hyper.temp)) - Sort Key: hyper."time", hyper.device - -> Custom Scan (ChunkAppend) on public.hyper - Output: hyper."time", hyper.device, (PARTIAL avg(hyper.temp)) - Order: hyper."time" - Startup Exclusion: false - Runtime Exclusion: false - -> Merge Append - Sort Key: _hyper_1_1_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Sort - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Index Scan Backward using _hyper_1_1_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Sort - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Index Scan Backward using _hyper_1_2_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Merge Append - Sort Key: _hyper_1_3_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Sort - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Index Scan Backward using _hyper_1_3_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Sort - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp - Sort Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Index Scan Backward using _hyper_1_4_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(47 rows) + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ + Sort + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Finalize HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Partial aggregation since date_trunc(time) is not a partition key SET enable_partitionwise_aggregate = 'off'; diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 78e1a02b51f..16c2a67b828 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -1647,14 +1647,41 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_3_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(18 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Partial GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 loops=1) @@ -1669,38 +1696,7 @@ ORDER BY device_id; Group Key: _hyper_1_3_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(20 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_3_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(21 rows) +(19 rows) SET enable_hashagg = ON; -- test CTE @@ -5647,14 +5643,63 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_5_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_6_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_10_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_11_chunk.device_id + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(40 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_4_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 loops=1) @@ -5669,22 +5714,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_10_chunk.device_id -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 loops=1) @@ -5695,72 +5734,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(50 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_5_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_6_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_10_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_11_chunk.device_id - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(51 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(41 rows) SET enable_hashagg = ON; -- test CTE From 20b694049b8f63e3d18b0366424929b093e9d988 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:25:52 +0200 Subject: [PATCH 071/157] parallel plans --- src/planner/partialize.c | 336 ++++++++++-------- .../expected/transparent_decompression-15.out | 27 +- tsl/test/expected/vectorized_aggregation.out | 288 +++++++++------ 3 files changed, 377 insertions(+), 274 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index c50204c2187..bb6dfb05a2b 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -233,31 +233,75 @@ get_existing_agg_path(const RelOptInfo *relation) /* * Get all subpaths from a Append, MergeAppend, or ChunkAppend path */ -static List * -get_subpaths_from_append_path(Path *path, bool handle_gather_path) +static void +get_subpaths_from_append_path(Path *path, List **subpaths, Path **append, Path **gather) { if (IsA(path, AppendPath)) { AppendPath *append_path = castNode(AppendPath, path); - return append_path->subpaths; + *subpaths = append_path->subpaths; + *append = path; + return; } - else if (IsA(path, MergeAppendPath)) + + if (IsA(path, MergeAppendPath)) { MergeAppendPath *merge_append_path = castNode(MergeAppendPath, path); - return merge_append_path->subpaths; + *subpaths = merge_append_path->subpaths; + *append = path; + return; } - else if (ts_is_chunk_append_path(path)) + + if (ts_is_chunk_append_path(path)) { CustomPath *custom_path = castNode(CustomPath, path); - return custom_path->custom_paths; + *subpaths = custom_path->custom_paths; + *append = path; + return; } - else if (handle_gather_path && IsA(path, GatherPath)) + + if (IsA(path, GatherPath)) { - return get_subpaths_from_append_path(castNode(GatherPath, path)->subpath, false); + *gather = path; + get_subpaths_from_append_path(castNode(GatherPath, path)->subpath, + subpaths, + append, + /* gather = */ NULL); + return; + } + + if (IsA(path, GatherMergePath)) + { + *gather = path; + get_subpaths_from_append_path(castNode(GatherMergePath, path)->subpath, + subpaths, + append, + /* gather = */ NULL); + return; + } + + if (IsA(path, SortPath)) + { + /* Can see GatherMerge -> Sort -> Partial HashAggregate in parallel plans. */ + get_subpaths_from_append_path(castNode(SortPath, path)->subpath, subpaths, append, gather); + return; + } + + if (IsA(path, AggPath)) + { + /* Can see GatherMerge -> Sort -> Partial HashAggregate in parallel plans. */ + get_subpaths_from_append_path(castNode(AggPath, path)->subpath, subpaths, append, gather); + return; + } + + if (IsA(path, ProjectionPath)) + { + ProjectionPath *projection = castNode(ProjectionPath, path); + get_subpaths_from_append_path(projection->subpath, subpaths, append, gather); + return; } /* Aggregation push-down is not supported for other path types so far */ - return NIL; } /* @@ -393,7 +437,7 @@ create_hashed_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target * Add partially aggregated subpath */ static void -add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, +add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, PathTarget *partial_grouping_target, double d_num_groups, GroupPathExtraData *extra_data, bool can_sort, bool can_hash, Path *subpath, List **sorted_paths, List **hashed_paths) @@ -404,9 +448,9 @@ add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, chunktarget->exprs = castNode(List, adjust_appendrel_attrs(root, (Node *) chunktarget->exprs, 1, &appinfo)); - /* In declarative partitioning planning, this is done by appy_scanjoin_target_to_path */ - Assert(list_length(subpath->pathtarget->exprs) == list_length(parent_path->pathtarget->exprs)); - subpath->pathtarget->sortgrouprefs = parent_path->pathtarget->sortgrouprefs; + /* In declarative partitioning planning, this is done by apply_scanjoin_target_to_path */ + Assert(list_length(subpath->pathtarget->exprs) == list_length(input_target->exprs)); + subpath->pathtarget->sortgrouprefs = input_target->sortgrouprefs; if (can_sort) { @@ -431,19 +475,38 @@ add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, * The generated paths contain partial aggregations (created by using AGGSPLIT_INITIAL_SERIAL). * These aggregations need to be finished by the caller by adding a node that performs the * AGGSPLIT_FINAL_DESERIAL step. + * + * The original path can be either parallel or non-parallel aggregation, and the + * resulting path will be parallel accordingly. */ static void -generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *output_rel, - RelOptInfo *partially_grouped_rel, PathTarget *grouping_target, - PathTarget *partial_grouping_target, bool can_sort, bool can_hash, - double d_num_groups, GroupPathExtraData *extra_data) +generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *input_rel, + RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, + PathTarget *grouping_target, PathTarget *partial_grouping_target, + bool can_sort, bool can_hash, double d_num_groups, + GroupPathExtraData *extra_data) { /* Get subpaths */ - List *subpaths = get_subpaths_from_append_path(cheapest_total_path, false); + List *subpaths = NIL; + Path *top_gather = NULL; + Path *top_append = NULL; + get_subpaths_from_append_path(cheapest_total_path, &subpaths, &top_append, &top_gather); /* No subpaths available or unsupported append node */ if (subpaths == NIL) + { + fprintf(stderr, "no subpaths\n"); return; + } + + Assert(top_append != NULL); + + fprintf(stderr, "found:\n"); + my_print(subpaths); + fprintf(stderr, "gather:\n"); + my_print(top_gather); + fprintf(stderr, "append:\n"); + my_print(top_append); if (list_length(subpaths) < 2) { @@ -470,36 +533,43 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI * In this case, the partial aggregation needs to be pushed down below the lower * append path. */ - List *subsubpaths = get_subpaths_from_append_path(subpath, false); - - if (subsubpaths != NIL) + List *partially_compressed_paths = NIL; + Path *partially_compressed_append = NULL; + Path *partially_compressed_gather = NULL; + get_subpaths_from_append_path(subpath, + &partially_compressed_paths, + &partially_compressed_append, + &partially_compressed_gather); + Assert(partially_compressed_gather == NULL); + + if (partially_compressed_append != NULL) { - List *sorted_subsubpaths = NIL; - List *hashed_subsubpaths = NIL; + List *partially_compressed_sorted = NIL; + List *partially_compressed_hashed = NIL; ListCell *lc2; - foreach (lc2, subsubpaths) + foreach (lc2, partially_compressed_paths) { - Path *subsubpath = lfirst(lc2); + Path *partially_compressed_path = lfirst(lc2); add_partially_aggregated_subpaths(root, - cheapest_total_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, can_sort, can_hash, - subsubpath, - &sorted_subsubpaths /* Result path */, - &hashed_subsubpaths /* Result path */); + partially_compressed_path, + &partially_compressed_sorted /* Result path */, + &partially_compressed_hashed /* Result path */); } if (can_sort) { sorted_subpaths = lappend(sorted_subpaths, copy_append_like_path(root, - subpath, - sorted_subsubpaths, + partially_compressed_append, + partially_compressed_sorted, subpath->pathtarget)); } @@ -507,15 +577,15 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI { hashed_subpaths = lappend(hashed_subpaths, copy_append_like_path(root, - subpath, - hashed_subsubpaths, + partially_compressed_append, + partially_compressed_hashed, subpath->pathtarget)); } } else { add_partially_aggregated_subpaths(root, - cheapest_total_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -528,22 +598,72 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI } /* Create new append paths */ - if (sorted_subpaths != NIL) + if (top_gather != NULL) { - add_path(partially_grouped_rel, - copy_append_like_path(root, - cheapest_total_path, - sorted_subpaths, - partial_grouping_target)); - } + /* + * The cheapest aggregation plan was parallel, so we're creating a + * parallel plan as well. + */ + fprintf(stderr, "with top gather\n"); + if (sorted_subpaths != NIL) + { + add_partial_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + sorted_subpaths, + partial_grouping_target)); + } + + if (hashed_subpaths != NIL) + { + add_partial_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + hashed_subpaths, + partial_grouping_target)); + } - if (hashed_subpaths != NIL) + /* Finish the partial paths (just added by add_partial_path to partially_grouped_rel in this + * function) by adding a gather node and add this path to the partially_grouped_rel using + * add_path). */ + foreach (lc, partially_grouped_rel->partial_pathlist) + { + Path *append_path = lfirst(lc); + double total_groups = append_path->rows * append_path->parallel_workers; + + Path *gather_path = (Path *) create_gather_path(root, + partially_grouped_rel, + append_path, + partially_grouped_rel->reltarget, + NULL, + &total_groups); + add_path(partially_grouped_rel, (Path *) gather_path); + } + } + else { - add_path(partially_grouped_rel, - copy_append_like_path(root, - cheapest_total_path, - hashed_subpaths, - partial_grouping_target)); + /* + * The original aggregation plan was non-parallel, so we're creating a + * non-parallel plan as well. + */ + fprintf(stderr, "no top gather\n"); + if (sorted_subpaths != NIL) + { + add_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + sorted_subpaths, + partial_grouping_target)); + } + + if (hashed_subpaths != NIL) + { + add_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + hashed_subpaths, + partial_grouping_target)); + } } } @@ -567,7 +687,8 @@ generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_pat GroupPathExtraData *extra_data) { /* Get subpaths */ - List *subpaths = get_subpaths_from_append_path(cheapest_partial_path, false); + // List *subpaths = get_subpaths_from_append_path(cheapest_partial_path, false); + List *subpaths = NIL; /* No subpaths available or unsupported append node */ if (subpaths == NIL) @@ -581,87 +702,6 @@ generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_pat */ return; } - /* Generate agg paths on top of the append children */ - ListCell *lc; - List *sorted_subpaths = NIL; - List *hashed_subpaths = NIL; - - foreach (lc, subpaths) - { - Path *subpath = lfirst(lc); - - Assert(subpath->parallel_safe); - - /* There should be no nested append paths in the partial paths to construct the upper - * relation */ - Assert(get_subpaths_from_append_path(subpath, false) == NIL); - - add_partially_aggregated_subpaths(root, - cheapest_partial_path, - partial_grouping_target, - d_num_groups, - extra_data, - can_sort, - can_hash, - subpath, - &sorted_subpaths /* Result paths */, - &hashed_subpaths /* Result paths */); - } - - /* Create new append paths */ - if (sorted_subpaths != NIL) - { - add_partial_path(partially_grouped_rel, - copy_append_like_path(root, - cheapest_partial_path, - sorted_subpaths, - partial_grouping_target)); - } - - if (hashed_subpaths != NIL) - { - add_partial_path(partially_grouped_rel, - copy_append_like_path(root, - cheapest_partial_path, - hashed_subpaths, - partial_grouping_target)); - } - - /* Finish the partial paths (just added by add_partial_path to partially_grouped_rel in this - * function) by adding a gather node and add this path to the partially_grouped_rel using - * add_path). */ - foreach (lc, partially_grouped_rel->partial_pathlist) - { - Path *append_path = lfirst(lc); - double total_groups = append_path->rows * append_path->parallel_workers; - - Path *gather_path = (Path *) create_gather_path(root, - partially_grouped_rel, - append_path, - partially_grouped_rel->reltarget, - NULL, - &total_groups); - add_path(partially_grouped_rel, (Path *) gather_path); - } -} - -/* - * Get the best total path for aggregation. Prefer chunk append paths if we have one, otherwise - * return the cheapest_total_path; - */ -static Path * -get_best_total_path(RelOptInfo *output_rel) -{ - ListCell *lc; - foreach (lc, output_rel->pathlist) - { - Path *path = lfirst(lc); - - if (ts_is_chunk_append_path(path)) - return path; - } - - return output_rel->cheapest_total_path; } /* @@ -682,7 +722,10 @@ is_path_sorted_or_plain_agg_path(Path *path) static bool contains_path_plain_or_sorted_agg(Path *path) { - List *subpaths = get_subpaths_from_append_path(path, true); + List *subpaths = NIL; + Path *append = NULL; + Path *gather = NULL; + get_subpaths_from_append_path(path, &subpaths, &append, &gather); Ensure(subpaths != NIL, "Unable to determine aggregation type"); @@ -770,10 +813,16 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel Assert(extra != NULL); GroupPathExtraData *extra_data = (GroupPathExtraData *) extra; + fprintf(stderr, "output pathlist:\n"); + my_print(output_rel->pathlist); + /* Determine the number of groups from the already planned aggregation */ AggPath *existing_agg_path = get_existing_agg_path(output_rel); if (existing_agg_path == NULL) + { + fprintf(stderr, "no existing agg path\n"); return; + } /* Skip partial aggregations already created by _timescaledb_functions.partialize_agg */ if (existing_agg_path->aggsplit == AGGSPLIT_INITIAL_SERIAL) @@ -818,14 +867,9 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel } /* Generate the aggregation pushdown path */ - (void) get_best_total_path; - //Path *cheapest_total_path = get_best_total_path(input_rel); - Path *cheapest_total_path = existing_agg_path->subpath; - Assert(cheapest_total_path != NULL); -// fprintf(stderr, "cheapest total path at partial agg entry point is:\n"); -// my_print(cheapest_total_path); generate_agg_pushdown_path(root, - cheapest_total_path, + &existing_agg_path->path, + input_rel, output_rel, partially_grouped_rel, grouping_target, @@ -835,22 +879,6 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel d_num_groups, extra_data); - /* The same as above but for partial paths */ - if (input_rel->partial_pathlist != NIL && input_rel->consider_parallel) - { - Path *cheapest_partial_path = linitial(input_rel->partial_pathlist); - generate_partial_agg_pushdown_path(root, - cheapest_partial_path, - output_rel, - partially_grouped_rel, - grouping_target, - partial_grouping_target, - can_sort, - can_hash, - d_num_groups, - extra_data); - } - /* Replan aggregation if we were able to generate partially grouped rel paths */ if (partially_grouped_rel->pathlist == NIL) return; diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 5f3ad6ec0f2..eaa0b5ea748 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -9376,22 +9376,25 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; (10 rows) EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v0 FROM metrics GROUP BY bucket; - QUERY PLAN --------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Finalize HashAggregate Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather Workers Planned: 3 - -> Partial HashAggregate - Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") - -> Result - -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk - -> Parallel Seq Scan on _hyper_1_2_chunk -(13 rows) + -> Parallel Append + -> Partial HashAggregate + Group Key: _hyper_1_1_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Partial HashAggregate + Group Key: _hyper_1_3_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk + -> Partial HashAggregate + Group Key: _hyper_1_2_chunk."time" + -> Parallel Seq Scan on _hyper_1_2_chunk +(16 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 5de9b0b1fe8..bdb69d9dee5 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -385,138 +385,210 @@ SELECT sum(segment_by_value) FROM testtable WHERE float_value > 0; -- Vectorization not possible due grouping :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.float_value Group Key: _hyper_1_1_chunk.float_value - -> Gather Merge + -> Gather Output: _hyper_1_1_chunk.float_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) Workers Planned: 2 - -> Sort - Output: _hyper_1_1_chunk.float_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Sort Key: _hyper_1_1_chunk.float_value + -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.float_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) - Group Key: _hyper_1_1_chunk.float_value - -> Parallel Append - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.float_value -(39 rows) + Group Key: _hyper_1_1_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.float_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) + Group Key: _hyper_1_2_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.float_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) + Group Key: _hyper_1_3_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.float_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.float_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.float_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.float_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.float_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.float_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.float_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.float_value +(63 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.int_value Group Key: _hyper_1_1_chunk.int_value - -> Gather Merge + -> Gather Output: _hyper_1_1_chunk.int_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) Workers Planned: 2 - -> Sort - Output: _hyper_1_1_chunk.int_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Sort Key: _hyper_1_1_chunk.int_value + -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.int_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) - Group Key: _hyper_1_1_chunk.int_value - -> Parallel Append - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value -(39 rows) + Group Key: _hyper_1_1_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.int_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) + Group Key: _hyper_1_2_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.int_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) + Group Key: _hyper_1_3_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.int_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.int_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.int_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.int_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.int_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.int_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.int_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value +(63 rows) :EXPLAIN SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Finalize HashAggregate Output: sum(_hyper_1_1_chunk.int_value), _hyper_1_1_chunk.segment_by_value Group Key: _hyper_1_1_chunk.segment_by_value - -> Gather Merge + -> Gather Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) Workers Planned: 2 - -> Sort - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) - Sort Key: _hyper_1_1_chunk.segment_by_value + -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.segment_by_value, PARTIAL sum(_hyper_1_1_chunk.int_value) - Group Key: _hyper_1_1_chunk.segment_by_value - -> Parallel Append - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value -(39 rows) + Group Key: _hyper_1_1_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.segment_by_value, PARTIAL sum(_hyper_1_2_chunk.int_value) + Group Key: _hyper_1_2_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.segment_by_value, PARTIAL sum(_hyper_1_3_chunk.int_value) + Group Key: _hyper_1_3_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.int_value) + Group Key: _hyper_1_4_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.int_value) + Group Key: _hyper_1_5_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.int_value) + Group Key: _hyper_1_6_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.int_value) + Group Key: _hyper_1_7_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.int_value) + Group Key: _hyper_1_8_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.int_value) + Group Key: _hyper_1_9_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.int_value) + Group Key: _hyper_1_10_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value +(63 rows) -- Vectorization not possible due to two variables and grouping :EXPLAIN From e017290885b6fcb7796a7fe9355d22efa65786c5 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:27:39 +0200 Subject: [PATCH 072/157] remove debug --- src/planner/partialize.c | 50 ---------------------------------------- 1 file changed, 50 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index bb6dfb05a2b..bf3ab3c5486 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -495,19 +495,11 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI /* No subpaths available or unsupported append node */ if (subpaths == NIL) { - fprintf(stderr, "no subpaths\n"); return; } Assert(top_append != NULL); - fprintf(stderr, "found:\n"); - my_print(subpaths); - fprintf(stderr, "gather:\n"); - my_print(top_gather); - fprintf(stderr, "append:\n"); - my_print(top_append); - if (list_length(subpaths) < 2) { /* @@ -604,7 +596,6 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI * The cheapest aggregation plan was parallel, so we're creating a * parallel plan as well. */ - fprintf(stderr, "with top gather\n"); if (sorted_subpaths != NIL) { add_partial_path(partially_grouped_rel, @@ -646,7 +637,6 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI * The original aggregation plan was non-parallel, so we're creating a * non-parallel plan as well. */ - fprintf(stderr, "no top gather\n"); if (sorted_subpaths != NIL) { add_path(partially_grouped_rel, @@ -667,42 +657,6 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI } } -/* - * Generate a partial aggregation path for chunk-wise partial aggregations. - - * This function does almost the same as generate_agg_pushdown_path(). In contrast, it processes a - * partial_path (paths that are usually used in parallel plans) of the input relation, pushes down - * the aggregation in this path and adds a gather node on top of the partial plan. Therefore, the - * push-down of the partial aggregates also works in parallel plans. - * - * Note: The PostgreSQL terminology can cause some confusion here. Partial paths are usually used by - * PostgreSQL to distribute work between parallel workers. This has nothing to do with the partial - * aggregation we are creating in the function. - */ -static void -generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_path, - RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, - PathTarget *grouping_target, PathTarget *partial_grouping_target, - bool can_sort, bool can_hash, double d_num_groups, - GroupPathExtraData *extra_data) -{ - /* Get subpaths */ - // List *subpaths = get_subpaths_from_append_path(cheapest_partial_path, false); - List *subpaths = NIL; - - /* No subpaths available or unsupported append node */ - if (subpaths == NIL) - return; - - if (list_length(subpaths) < 2) - { - /* - * Doesn't make sense to add per-chunk aggregation paths if there's - * only one chunk. - */ - return; - } -} /* Is the provided path a agg path that uses a sorted or plain agg strategy? @@ -813,14 +767,10 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel Assert(extra != NULL); GroupPathExtraData *extra_data = (GroupPathExtraData *) extra; - fprintf(stderr, "output pathlist:\n"); - my_print(output_rel->pathlist); - /* Determine the number of groups from the already planned aggregation */ AggPath *existing_agg_path = get_existing_agg_path(output_rel); if (existing_agg_path == NULL) { - fprintf(stderr, "no existing agg path\n"); return; } From b0d9c4462bb005fd1ecaa5f98c0315fdd9c24bad Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:29:48 +0200 Subject: [PATCH 073/157] easier diff --- src/planner/partialize.c | 50 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index bf3ab3c5486..3326ae4caa7 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -590,7 +590,31 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI } /* Create new append paths */ - if (top_gather != NULL) + if (top_gather == NULL) + { + /* + * The original aggregation plan was non-parallel, so we're creating a + * non-parallel plan as well. + */ + if (sorted_subpaths != NIL) + { + add_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + sorted_subpaths, + partial_grouping_target)); + } + + if (hashed_subpaths != NIL) + { + add_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + hashed_subpaths, + partial_grouping_target)); + } + } + else { /* * The cheapest aggregation plan was parallel, so we're creating a @@ -631,30 +655,6 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI add_path(partially_grouped_rel, (Path *) gather_path); } } - else - { - /* - * The original aggregation plan was non-parallel, so we're creating a - * non-parallel plan as well. - */ - if (sorted_subpaths != NIL) - { - add_path(partially_grouped_rel, - copy_append_like_path(root, - top_append, - sorted_subpaths, - partial_grouping_target)); - } - - if (hashed_subpaths != NIL) - { - add_path(partially_grouped_rel, - copy_append_like_path(root, - top_append, - hashed_subpaths, - partial_grouping_target)); - } - } } From c66df2566426953604bae8804c43479ebc8c3e5f Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:30:25 +0200 Subject: [PATCH 074/157] cleanup --- src/planner/partialize.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index 3326ae4caa7..303b0354caf 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -657,7 +657,6 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI } } - /* Is the provided path a agg path that uses a sorted or plain agg strategy? */ From 06a2606d6586781e2622a34c0b14b581d13c4c0e Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:40:19 +0200 Subject: [PATCH 075/157] fixes for projection --- src/planner/partialize.c | 40 +++- tsl/test/expected/continuous_aggs-15.out | 50 +++-- .../expected/transparent_decompression-15.out | 22 +- tsl/test/expected/vectorized_aggregation.out | 210 ++++++++++-------- 4 files changed, 186 insertions(+), 136 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index 303b0354caf..0ae0c131898 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -444,26 +444,46 @@ add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, { /* Translate targetlist for partition */ AppendRelInfo *appinfo = ts_get_appendrelinfo(root, subpath->parent->relid, false); - PathTarget *chunktarget = copy_pathtarget(partial_grouping_target); - chunktarget->exprs = - castNode(List, adjust_appendrel_attrs(root, (Node *) chunktarget->exprs, 1, &appinfo)); + PathTarget *chunk_grouped_target = copy_pathtarget(partial_grouping_target); + chunk_grouped_target->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_grouped_target->exprs, + /* nappinfos = */ 1, + &appinfo)); - /* In declarative partitioning planning, this is done by apply_scanjoin_target_to_path */ - Assert(list_length(subpath->pathtarget->exprs) == list_length(input_target->exprs)); - subpath->pathtarget->sortgrouprefs = input_target->sortgrouprefs; + /* + * We might have to project before aggregation. In declarative partitioning + * planning, the projection is applied by apply_scanjoin_target_to_path(). + */ + PathTarget *chunk_target_before_grouping = copy_pathtarget(input_target); + chunk_target_before_grouping->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_target_before_grouping->exprs, + /* nappinfos = */ 1, + &appinfo)); + subpath = + apply_projection_to_path(root, subpath->parent, subpath, chunk_target_before_grouping); if (can_sort) { - AggPath *agg_path = - create_sorted_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); + AggPath *agg_path = create_sorted_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); *sorted_paths = lappend(*sorted_paths, (Path *) agg_path); } if (can_hash) { - AggPath *agg_path = - create_hashed_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); + AggPath *agg_path = create_hashed_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); *hashed_paths = lappend(*hashed_paths, (Path *) agg_path); } diff --git a/tsl/test/expected/continuous_aggs-15.out b/tsl/test/expected/continuous_aggs-15.out index 3a9e83e9463..decbc17e3cd 100644 --- a/tsl/test/expected/continuous_aggs-15.out +++ b/tsl/test/expected/continuous_aggs-15.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2047,15 +2047,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(18 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(23 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2068,8 +2073,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2082,15 +2087,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(20 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(25 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index eaa0b5ea748..34b1a3294a9 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -9376,25 +9376,27 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; (10 rows) EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v0 FROM metrics GROUP BY bucket; - QUERY PLAN ------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Finalize HashAggregate Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather Workers Planned: 3 -> Parallel Append -> Partial HashAggregate - Group Key: _hyper_1_1_chunk."time" - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") + -> Result + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Partial HashAggregate - Group Key: _hyper_1_3_chunk."time" - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") + -> Result + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Partial HashAggregate - Group Key: _hyper_1_2_chunk."time" + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_2_chunk."time") -> Parallel Seq Scan on _hyper_1_2_chunk -(16 rows) +(18 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index bdb69d9dee5..2cacb6946f8 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -385,8 +385,8 @@ SELECT sum(segment_by_value) FROM testtable WHERE float_value > 0; -- Vectorization not possible due grouping :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.float_value Group Key: _hyper_1_1_chunk.float_value @@ -396,66 +396,72 @@ SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.float_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) - Group Key: _hyper_1_1_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Group Key: _hyper_1_1_chunk.float_value + -> Result + Output: _hyper_1_1_chunk.float_value, _hyper_1_1_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Partial HashAggregate Output: _hyper_1_2_chunk.float_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) - Group Key: _hyper_1_2_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Group Key: _hyper_1_2_chunk.float_value + -> Result + Output: _hyper_1_2_chunk.float_value, _hyper_1_2_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Partial HashAggregate Output: _hyper_1_3_chunk.float_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) - Group Key: _hyper_1_3_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Group Key: _hyper_1_3_chunk.float_value + -> Result + Output: _hyper_1_3_chunk.float_value, _hyper_1_3_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate Output: _hyper_1_4_chunk.float_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - Group Key: _hyper_1_4_chunk.segment_by_value + Group Key: _hyper_1_4_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.float_value + Output: _hyper_1_4_chunk.float_value, _hyper_1_4_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_5_chunk.float_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - Group Key: _hyper_1_5_chunk.segment_by_value + Group Key: _hyper_1_5_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.float_value + Output: _hyper_1_5_chunk.float_value, _hyper_1_5_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_6_chunk.float_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - Group Key: _hyper_1_6_chunk.segment_by_value + Group Key: _hyper_1_6_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.float_value + Output: _hyper_1_6_chunk.float_value, _hyper_1_6_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_7_chunk.float_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - Group Key: _hyper_1_7_chunk.segment_by_value + Group Key: _hyper_1_7_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.float_value + Output: _hyper_1_7_chunk.float_value, _hyper_1_7_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_8_chunk.float_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - Group Key: _hyper_1_8_chunk.segment_by_value + Group Key: _hyper_1_8_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.float_value + Output: _hyper_1_8_chunk.float_value, _hyper_1_8_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_9_chunk.float_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - Group Key: _hyper_1_9_chunk.segment_by_value + Group Key: _hyper_1_9_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.float_value + Output: _hyper_1_9_chunk.float_value, _hyper_1_9_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_10_chunk.float_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - Group Key: _hyper_1_10_chunk.segment_by_value + Group Key: _hyper_1_10_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.float_value -(63 rows) + Output: _hyper_1_10_chunk.float_value, _hyper_1_10_chunk.segment_by_value +(69 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.int_value Group Key: _hyper_1_1_chunk.int_value @@ -465,66 +471,72 @@ SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.int_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) - Group Key: _hyper_1_1_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Group Key: _hyper_1_1_chunk.int_value + -> Result + Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Partial HashAggregate Output: _hyper_1_2_chunk.int_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) - Group Key: _hyper_1_2_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Group Key: _hyper_1_2_chunk.int_value + -> Result + Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Partial HashAggregate Output: _hyper_1_3_chunk.int_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) - Group Key: _hyper_1_3_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Group Key: _hyper_1_3_chunk.int_value + -> Result + Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate Output: _hyper_1_4_chunk.int_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - Group Key: _hyper_1_4_chunk.segment_by_value + Group Key: _hyper_1_4_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value + Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_5_chunk.int_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - Group Key: _hyper_1_5_chunk.segment_by_value + Group Key: _hyper_1_5_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value + Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_6_chunk.int_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - Group Key: _hyper_1_6_chunk.segment_by_value + Group Key: _hyper_1_6_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value + Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_7_chunk.int_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - Group Key: _hyper_1_7_chunk.segment_by_value + Group Key: _hyper_1_7_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value + Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_8_chunk.int_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - Group Key: _hyper_1_8_chunk.segment_by_value + Group Key: _hyper_1_8_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value + Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_9_chunk.int_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - Group Key: _hyper_1_9_chunk.segment_by_value + Group Key: _hyper_1_9_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value + Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value -> Partial HashAggregate Output: _hyper_1_10_chunk.int_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - Group Key: _hyper_1_10_chunk.segment_by_value + Group Key: _hyper_1_10_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value -(63 rows) + Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value +(69 rows) :EXPLAIN SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.int_value), _hyper_1_1_chunk.segment_by_value Group Key: _hyper_1_1_chunk.segment_by_value @@ -534,61 +546,67 @@ SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.segment_by_value, PARTIAL sum(_hyper_1_1_chunk.int_value) - Group Key: _hyper_1_1_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Group Key: _hyper_1_1_chunk.segment_by_value + -> Result + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Partial HashAggregate Output: _hyper_1_2_chunk.segment_by_value, PARTIAL sum(_hyper_1_2_chunk.int_value) - Group Key: _hyper_1_2_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Group Key: _hyper_1_2_chunk.segment_by_value + -> Result + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Partial HashAggregate Output: _hyper_1_3_chunk.segment_by_value, PARTIAL sum(_hyper_1_3_chunk.int_value) - Group Key: _hyper_1_3_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Group Key: _hyper_1_3_chunk.segment_by_value + -> Result + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.int_value) - Group Key: _hyper_1_4_chunk.int_value + Group Key: _hyper_1_4_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value + Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value -> Partial HashAggregate Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.int_value) - Group Key: _hyper_1_5_chunk.int_value + Group Key: _hyper_1_5_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value + Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value -> Partial HashAggregate Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.int_value) - Group Key: _hyper_1_6_chunk.int_value + Group Key: _hyper_1_6_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value + Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value -> Partial HashAggregate Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.int_value) - Group Key: _hyper_1_7_chunk.int_value + Group Key: _hyper_1_7_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value + Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value -> Partial HashAggregate Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.int_value) - Group Key: _hyper_1_8_chunk.int_value + Group Key: _hyper_1_8_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value + Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value -> Partial HashAggregate Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.int_value) - Group Key: _hyper_1_9_chunk.int_value + Group Key: _hyper_1_9_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value + Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value -> Partial HashAggregate Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.int_value) - Group Key: _hyper_1_10_chunk.int_value + Group Key: _hyper_1_10_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value -(63 rows) + Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value +(69 rows) -- Vectorization not possible due to two variables and grouping :EXPLAIN From 9a0a9885214c244e702dc82b31fb1724a551ad29 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 19 Jun 2024 14:40:52 +0200 Subject: [PATCH 076/157] stabilize the cagg tests --- tsl/test/expected/cagg_ddl-15.out | 16 +- tsl/test/expected/cagg_on_cagg.out | 96 +++++----- tsl/test/expected/cagg_on_cagg_joins.out | 96 +++++----- tsl/test/expected/cagg_query.out | 64 ++++--- tsl/test/expected/cagg_union_view-15.out | 109 ++++++----- tsl/test/expected/cagg_watermark-15.out | 184 ++++++++++++------- tsl/test/sql/cagg_ddl.sql.in | 10 +- tsl/test/sql/cagg_migrate_function.sql.in | 4 +- tsl/test/sql/include/cagg_on_cagg_common.sql | 12 +- 9 files changed, 338 insertions(+), 253 deletions(-) diff --git a/tsl/test/expected/cagg_ddl-15.out b/tsl/test/expected/cagg_ddl-15.out index 0e4c513a179..66a4a81d623 100644 --- a/tsl/test/expected/cagg_ddl-15.out +++ b/tsl/test/expected/cagg_ddl-15.out @@ -1804,7 +1804,7 @@ View definition: _materialized_hypertable_45.cashflow2 FROM _timescaledb_internal._materialized_hypertable_45; -SELECT * FROM cashflows; +SELECT * FROM cashflows ORDER BY cashflows; bucket | amount | cashflow | cashflow2 ------------------------------+--------+----------+----------- Sun Dec 31 16:00:00 2017 PST | 1 | 10 | 11 @@ -1963,7 +1963,7 @@ View definition: FROM _timescaledb_internal._materialized_hypertable_53; -- Should return NO ROWS -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+--------+----- (0 rows) @@ -1991,13 +1991,13 @@ UNION ALL GROUP BY conditions.location, (time_bucket('@ 1 day'::interval, conditions."time")); -- Should return ROWS because now it is realtime -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+------------------------------+----- SFO | Sun Dec 31 16:00:00 2017 PST | 55 - SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Mon Jan 01 16:00:00 2018 PST | 65 por | Mon Jan 01 16:00:00 2018 PST | 100 + SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Wed Oct 31 17:00:00 2018 PDT | 65 NYC | Thu Nov 01 17:00:00 2018 PDT | 15 (6 rows) @@ -2018,13 +2018,13 @@ View definition: FROM _timescaledb_internal._materialized_hypertable_53; CALL refresh_continuous_aggregate('conditions_daily', NULL, NULL); -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+------------------------------+----- SFO | Sun Dec 31 16:00:00 2017 PST | 55 - SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Mon Jan 01 16:00:00 2018 PST | 65 por | Mon Jan 01 16:00:00 2018 PST | 100 + SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Wed Oct 31 17:00:00 2018 PDT | 65 NYC | Thu Nov 01 17:00:00 2018 PDT | 15 (6 rows) @@ -2081,13 +2081,13 @@ SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark (1 row) -- Should return ROWS because the watermark was reseted by the TRUNCATE -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+------------------------------+----- SFO | Sun Dec 31 16:00:00 2017 PST | 55 - SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Mon Jan 01 16:00:00 2018 PST | 65 por | Mon Jan 01 16:00:00 2018 PST | 100 + SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Wed Oct 31 17:00:00 2018 PDT | 65 NYC | Thu Nov 01 17:00:00 2018 PDT | 15 (6 rows) diff --git a/tsl/test/expected/cagg_on_cagg.out b/tsl/test/expected/cagg_on_cagg.out index 6be39d78011..ea1e9565b02 100644 --- a/tsl/test/expected/cagg_on_cagg.out +++ b/tsl/test/expected/cagg_on_cagg.out @@ -368,7 +368,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_4_4_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -376,17 +376,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -395,17 +395,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -415,7 +415,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_2_7_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -764,7 +764,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_8_11_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -772,17 +772,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -791,17 +791,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -811,7 +811,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_6_14_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -1486,7 +1486,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_16_18_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1494,17 +1494,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -1513,17 +1513,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1533,7 +1533,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_14_20_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -1878,7 +1878,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_20_24_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1886,17 +1886,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -1905,17 +1905,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1925,7 +1925,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_18_26_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -2700,7 +2700,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_29_30_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -2708,17 +2708,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -2727,17 +2727,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -2747,7 +2747,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_27_32_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -3091,7 +3091,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_33_36_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -3099,17 +3099,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -3118,17 +3118,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -3138,7 +3138,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_31_38_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- diff --git a/tsl/test/expected/cagg_on_cagg_joins.out b/tsl/test/expected/cagg_on_cagg_joins.out index 34bf41ecf4c..8e19848837d 100644 --- a/tsl/test/expected/cagg_on_cagg_joins.out +++ b/tsl/test/expected/cagg_on_cagg_joins.out @@ -379,7 +379,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_4_4_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -387,17 +387,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -406,17 +406,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -426,7 +426,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_2_7_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -786,7 +786,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_8_11_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -794,17 +794,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -813,17 +813,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -833,7 +833,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_6_14_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -1522,7 +1522,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_16_18_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1530,17 +1530,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -1549,17 +1549,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1569,7 +1569,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_14_20_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -1924,7 +1924,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_20_24_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1932,17 +1932,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -1951,17 +1951,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1971,7 +1971,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_18_26_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -2761,7 +2761,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_29_30_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -2769,17 +2769,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -2788,17 +2788,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -2808,7 +2808,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_27_32_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -3163,7 +3163,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_33_36_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -3171,17 +3171,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -3190,17 +3190,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -3210,7 +3210,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_31_38_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- diff --git a/tsl/test/expected/cagg_query.out b/tsl/test/expected/cagg_query.out index fce7a54d4e5..0cd74a2e79f 100644 --- a/tsl/test/expected/cagg_query.out +++ b/tsl/test/expected/cagg_query.out @@ -112,25 +112,35 @@ select * from mat_m1 order by sumh, sumt, minl, timec ; :EXPLAIN select * from regview order by timec desc; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (min(_hyper_1_1_chunk.location)), (sum(_hyper_1_1_chunk.temperature)), (sum(_hyper_1_1_chunk.humidity)) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) DESC - -> GroupAggregate + -> Finalize GroupAggregate Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), min(_hyper_1_1_chunk.location), sum(_hyper_1_1_chunk.temperature), sum(_hyper_1_1_chunk.humidity) Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) -> Sort - Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (PARTIAL min(_hyper_1_1_chunk.location)), (PARTIAL sum(_hyper_1_1_chunk.temperature)), (PARTIAL sum(_hyper_1_1_chunk.humidity)) Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) - -> Result - Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Append - -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.location, _hyper_1_1_chunk.timec, _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.location, _hyper_1_2_chunk.timec, _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity -(16 rows) + -> Append + -> Partial GroupAggregate + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), PARTIAL min(_hyper_1_1_chunk.location), PARTIAL sum(_hyper_1_1_chunk.temperature), PARTIAL sum(_hyper_1_1_chunk.humidity) + Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Sort + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + -> Partial GroupAggregate + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), PARTIAL min(_hyper_1_2_chunk.location), PARTIAL sum(_hyper_1_2_chunk.temperature), PARTIAL sum(_hyper_1_2_chunk.humidity) + Group Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Sort + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity + Sort Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity +(26 rows) -- PUSHDOWN cases -- -- all group by elts in order by , reorder group by elts to match @@ -446,19 +456,29 @@ select * from mat_m1, regview where mat_m1.timec > '2018-10-01' and mat_m1.timec -> Hash Join Output: _hyper_2_4_chunk.location, _hyper_2_4_chunk.timec, _hyper_2_4_chunk.minl, _hyper_2_4_chunk.sumt, _hyper_2_4_chunk.sumh, _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (min(_hyper_1_1_chunk.location)), (sum(_hyper_1_1_chunk.temperature)), (sum(_hyper_1_1_chunk.humidity)) Hash Cond: ((time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) = _hyper_2_4_chunk.timec) - -> GroupAggregate + -> Finalize GroupAggregate Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), min(_hyper_1_1_chunk.location), sum(_hyper_1_1_chunk.temperature), sum(_hyper_1_1_chunk.humidity) Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) -> Sort - Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (PARTIAL min(_hyper_1_1_chunk.location)), (PARTIAL sum(_hyper_1_1_chunk.temperature)), (PARTIAL sum(_hyper_1_1_chunk.humidity)) Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) - -> Result - Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Append - -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.location, _hyper_1_1_chunk.timec, _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.location, _hyper_1_2_chunk.timec, _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity + -> Append + -> Partial GroupAggregate + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), PARTIAL min(_hyper_1_1_chunk.location), PARTIAL sum(_hyper_1_1_chunk.temperature), PARTIAL sum(_hyper_1_1_chunk.humidity) + Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Sort + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + -> Partial GroupAggregate + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), PARTIAL min(_hyper_1_2_chunk.location), PARTIAL sum(_hyper_1_2_chunk.temperature), PARTIAL sum(_hyper_1_2_chunk.humidity) + Group Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Sort + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity + Sort Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity -> Hash Output: _hyper_2_4_chunk.location, _hyper_2_4_chunk.timec, _hyper_2_4_chunk.minl, _hyper_2_4_chunk.sumt, _hyper_2_4_chunk.sumh -> Append @@ -477,7 +497,7 @@ select * from mat_m1, regview where mat_m1.timec > '2018-10-01' and mat_m1.timec Output: _hyper_1_2_chunk_1.location, _hyper_1_2_chunk_1.timec, _hyper_1_2_chunk_1.temperature, _hyper_1_2_chunk_1.humidity Index Cond: ((_hyper_1_2_chunk_1.timec >= 'Sat Nov 03 17:00:00 2018 PDT'::timestamp with time zone) AND (_hyper_1_2_chunk_1.timec > 'Mon Oct 01 00:00:00 2018 PDT'::timestamp with time zone)) Filter: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk_1.timec) > 'Mon Oct 01 00:00:00 2018 PDT'::timestamp with time zone) -(37 rows) +(47 rows) select l.locid, mat_m1.* from mat_m1 , location_tab l where timec > '2018-10-01' and l.locname = mat_m1.location order by timec desc; locid | location | timec | minl | sumt | sumh diff --git a/tsl/test/expected/cagg_union_view-15.out b/tsl/test/expected/cagg_union_view-15.out index 24a7a3eda40..7b769ad257b 100644 --- a/tsl/test/expected/cagg_union_view-15.out +++ b/tsl/test/expected/cagg_union_view-15.out @@ -354,22 +354,31 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- - HashAggregate (actual rows=4 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - Batches: 1 - -> Result (actual rows=4 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=4 loops=1) + Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) + -> Sort (actual rows=4 loops=1) + Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) + Sort Method: quicksort -> Append (actual rows=4 loops=1) - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(13 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(22 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -393,21 +402,26 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - Batches: 1 - -> Result (actual rows=2 loops=1) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) + -> Sort (actual rows=2 loops=1) + Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) + Sort Method: quicksort -> Append (actual rows=2 loops=1) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(12 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(17 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -577,32 +591,39 @@ ORDER by 1; -- plan output :PREFIX SELECT * FROM mat_m1 ORDER BY 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=3 loops=1) Sort Key: _hyper_9_15_chunk.time_bucket Sort Method: quicksort -> Append (actual rows=3 loops=1) -> Index Scan using _hyper_9_15_chunk__materialized_hypertable_9_time_bucket_idx on _hyper_9_15_chunk (actual rows=1 loops=1) Index Cond: (time_bucket < 25) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(5, _hyper_7_11_chunk.a)) Filter: ((sum(_hyper_7_11_chunk.c) > 50) AND ((avg(_hyper_7_11_chunk.b))::integer > 12)) - Batches: 1 Rows Removed by Filter: 1 - -> Result (actual rows=6 loops=1) - -> Append (actual rows=6 loops=1) - -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - Rows Removed by Filter: 2 -(23 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket(5, _hyper_7_11_chunk.a)) + Sort Method: quicksort + -> Append (actual rows=3 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_13_chunk.a) + -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_14_chunk.a) + -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + Rows Removed by Filter: 2 +(30 rows) -- Test caggs with different time types CREATE TABLE smallint_table (time smallint, value int); diff --git a/tsl/test/expected/cagg_watermark-15.out b/tsl/test/expected/cagg_watermark-15.out index 8800c7c5125..da9a5017370 100644 --- a/tsl/test/expected/cagg_watermark-15.out +++ b/tsl/test/expected/cagg_watermark-15.out @@ -467,16 +467,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -484,16 +489,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); :EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; @@ -502,18 +512,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -521,18 +539,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) -- Materialize CAgg and check for plan time chunk exclusion CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); @@ -1187,15 +1213,17 @@ CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 1 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 1 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_49_chunk."time"), _hyper_7_49_chunk.device + Batches: 1 -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(43 rows) +(45 rows) RESET timescaledb.enable_cagg_watermark_constify; -- Select with projection @@ -1304,12 +1332,14 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Append (actual rows=3 loops=1) @@ -1353,15 +1383,17 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Result (actual rows=0 loops=1) One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks_1."time"), chunks_1.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks_1."time")), chunks_1.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk_1."time"), _hyper_7_51_chunk_1.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(94 rows) +(98 rows) -- Aggregation query over CAgg should be constified :EXPLAIN_ANALYZE SELECT max(device) from chunks_1h; @@ -1576,31 +1608,39 @@ UNION ALL FROM small_integer_ht WHERE small_integer_ht."time" < COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) GROUP BY (time_bucket(5, small_integer_ht."time")); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=6 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht."time") - Batches: 1 - -> Result (actual rows=0 loops=1) + -> Finalize GroupAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht."time")) + -> Sort (actual rows=0 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht."time")) + Sort Method: quicksort -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) Chunks excluded during startup: 3 - -> HashAggregate (actual rows=6 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht_1."time") - Batches: 1 - -> Result (actual rows=26 loops=1) - -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=26 loops=1) + -> Finalize GroupAggregate (actual rows=6 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + -> Sort (actual rows=6 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=6 loops=1) Chunks excluded during startup: 0 - -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 6 -(22 rows) + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_61_chunk."time") + -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_62_chunk."time") + -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_63_chunk."time") + -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 6 +(30 rows) -- test with non constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1661,16 +1701,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(55 rows) +(57 rows) -- test with NULL constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1731,16 +1773,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(55 rows) +(57 rows) -- test with double COALESCE function (should be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max diff --git a/tsl/test/sql/cagg_ddl.sql.in b/tsl/test/sql/cagg_ddl.sql.in index 84d8ce6c835..ca2c6d61ba3 100644 --- a/tsl/test/sql/cagg_ddl.sql.in +++ b/tsl/test/sql/cagg_ddl.sql.in @@ -1163,7 +1163,7 @@ WHERE user_view_name = 'cashflows' \d+ "_timescaledb_internal".:"MAT_TABLE_NAME" \d+ 'cashflows' -SELECT * FROM cashflows; +SELECT * FROM cashflows ORDER BY cashflows; -- test cagg creation with named arguments in time_bucket -- note that positional arguments cannot follow named arguments @@ -1281,20 +1281,20 @@ WITH NO DATA; \d+ conditions_daily -- Should return NO ROWS -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; ALTER MATERIALIZED VIEW conditions_daily SET (timescaledb.materialized_only=false); \d+ conditions_daily -- Should return ROWS because now it is realtime -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; -- Should return ROWS because we refreshed it ALTER MATERIALIZED VIEW conditions_daily SET (timescaledb.materialized_only=true); \d+ conditions_daily CALL refresh_continuous_aggregate('conditions_daily', NULL, NULL); -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; -- Test TRUNCATE over a Realtime CAgg DROP MATERIALIZED VIEW conditions_daily; @@ -1332,7 +1332,7 @@ SELECT count(*) FROM show_chunks('conditions_daily'); SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:mat_hypertable_id)) AS watermak_after; -- Should return ROWS because the watermark was reseted by the TRUNCATE -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; -- check compression settings are cleaned up when deleting a cagg with compression CREATE TABLE cagg_cleanup(time timestamptz not null); diff --git a/tsl/test/sql/cagg_migrate_function.sql.in b/tsl/test/sql/cagg_migrate_function.sql.in index efc8353e19c..4356c80044b 100644 --- a/tsl/test/sql/cagg_migrate_function.sql.in +++ b/tsl/test/sql/cagg_migrate_function.sql.in @@ -203,7 +203,7 @@ SELECT time_bucket('1 week', time, origin=>'2000-01-01 00:00:00+01'), sensor, av ORDER BY 1, 2; -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week; +SELECT * FROM cagg_temp_ng_1week ORDER BY time, sensor; ---- @@ -244,7 +244,7 @@ SELECT timescaledb_experimental.time_bucket_ng('1 week', time, '2005-01-01 15:00 ORDER BY 1, 2; -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week_corgin; +SELECT * FROM cagg_temp_ng_1week_corgin ORDER BY time, sensor; ---- -- Check bucket conversion -- timestamp without custom origin diff --git a/tsl/test/sql/include/cagg_on_cagg_common.sql b/tsl/test/sql/include/cagg_on_cagg_common.sql index 8f0e73346cb..3c2132419d6 100644 --- a/tsl/test/sql/include/cagg_on_cagg_common.sql +++ b/tsl/test/sql/include/cagg_on_cagg_common.sql @@ -173,29 +173,29 @@ CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; -- DROP the 2TH level CAGG don't affect others DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; -- DROP the first CAGG should work DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; \set ON_ERROR_STOP 1 From 21fb3aec1f55411f4b28a9138986fa8597c69d87 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:00:39 +0200 Subject: [PATCH 077/157] Support chunkwise aggregation with projection This is important for the common case of grouping by time_bucket(). In this case, under AggPath there is a ProjectionPath above the Append node for all the chunks. When we make a chunkwise aggregation plan, we have to put a similar ProjectionPath under each per-chunk AggPath. --- src/planner/partialize.c | 92 +- test/expected/append-15.out | 56 +- test/expected/insert_many.out | 904 ++++++++++++++---- test/expected/partitionwise-15.out | 226 +++-- test/expected/query-15.out | 68 +- test/expected/sql_query.out | 68 +- test/sql/partitionwise.sql.in | 6 +- tsl/test/expected/cagg_ddl-15.out | 16 +- tsl/test/expected/cagg_on_cagg.out | 96 +- tsl/test/expected/cagg_on_cagg_joins.out | 96 +- tsl/test/expected/cagg_query.out | 64 +- tsl/test/expected/cagg_union_view-15.out | 109 ++- tsl/test/expected/cagg_watermark-15.out | 184 ++-- tsl/test/expected/continuous_aggs-15.out | 50 +- .../expected/transparent_decompression-15.out | 21 +- tsl/test/expected/vectorized_aggregation.out | 216 +++-- tsl/test/sql/cagg_ddl.sql.in | 10 +- tsl/test/sql/cagg_migrate_function.sql.in | 4 +- tsl/test/sql/include/cagg_on_cagg_common.sql | 12 +- 19 files changed, 1579 insertions(+), 719 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index ea13257d904..da6345593a1 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -255,6 +255,10 @@ get_subpaths_from_append_path(Path *path, bool handle_gather_path) { return get_subpaths_from_append_path(castNode(GatherPath, path)->subpath, false); } + else if (IsA(path, ProjectionPath)) + { + return get_subpaths_from_append_path(castNode(ProjectionPath, path)->subpath, false); + } /* Aggregation push-down is not supported for other path types so far */ return NIL; @@ -319,6 +323,17 @@ copy_append_like_path(PlannerInfo *root, Path *path, List *new_subpaths, PathTar ts_chunk_append_path_copy(chunk_append_path, new_subpaths, pathtarget); return &new_chunk_append_path->cpath.path; } + else if (IsA(path, ProjectionPath)) + { + /* + * Projection goes under partial aggregation, so here we can just ignore + * it. + */ + return copy_append_like_path(root, + castNode(ProjectionPath, path)->subpath, + new_subpaths, + pathtarget); + } /* Should never happen, already checked by caller */ Ensure(false, "unknown path type"); @@ -393,33 +408,58 @@ create_hashed_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target * Add partially aggregated subpath */ static void -add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, +add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, PathTarget *partial_grouping_target, double d_num_groups, GroupPathExtraData *extra_data, bool can_sort, bool can_hash, Path *subpath, List **sorted_paths, List **hashed_paths) { /* Translate targetlist for partition */ AppendRelInfo *appinfo = ts_get_appendrelinfo(root, subpath->parent->relid, false); - PathTarget *chunktarget = copy_pathtarget(partial_grouping_target); - chunktarget->exprs = - castNode(List, adjust_appendrel_attrs(root, (Node *) chunktarget->exprs, 1, &appinfo)); + PathTarget *chunk_grouped_target = copy_pathtarget(partial_grouping_target); + chunk_grouped_target->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_grouped_target->exprs, + /* nappinfos = */ 1, + &appinfo)); - /* In declarative partitioning planning, this is done by appy_scanjoin_target_to_path */ - Assert(list_length(subpath->pathtarget->exprs) == list_length(parent_path->pathtarget->exprs)); - subpath->pathtarget->sortgrouprefs = parent_path->pathtarget->sortgrouprefs; + /* + * We might have to project before aggregation. In declarative partitioning + * planning, the projection is applied by apply_scanjoin_target_to_path(). + */ + PathTarget *chunk_target_before_grouping = copy_pathtarget(input_target); + chunk_target_before_grouping->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_target_before_grouping->exprs, + /* nappinfos = */ 1, + &appinfo)); + /* + * Note that we cannot use apply_projection_to_path() here, because it might + * modify the targetlist of the projection-capable paths in place, which + * would cause a mismatch when these paths are used in another context. + */ + subpath = (Path *) + create_projection_path(root, subpath->parent, subpath, chunk_target_before_grouping); if (can_sort) { - AggPath *agg_path = - create_sorted_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); + AggPath *agg_path = create_sorted_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); *sorted_paths = lappend(*sorted_paths, (Path *) agg_path); } if (can_hash) { - AggPath *agg_path = - create_hashed_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); + AggPath *agg_path = create_hashed_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); *hashed_paths = lappend(*hashed_paths, (Path *) agg_path); } @@ -433,10 +473,11 @@ add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, * AGGSPLIT_FINAL_DESERIAL step. */ static void -generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *output_rel, - RelOptInfo *partially_grouped_rel, PathTarget *grouping_target, - PathTarget *partial_grouping_target, bool can_sort, bool can_hash, - double d_num_groups, GroupPathExtraData *extra_data) +generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *input_rel, + RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, + PathTarget *grouping_target, PathTarget *partial_grouping_target, + bool can_sort, bool can_hash, double d_num_groups, + GroupPathExtraData *extra_data) { /* Get subpaths */ List *subpaths = get_subpaths_from_append_path(cheapest_total_path, false); @@ -483,7 +524,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI Path *subsubpath = lfirst(lc2); add_partially_aggregated_subpaths(root, - cheapest_total_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -515,7 +556,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI else { add_partially_aggregated_subpaths(root, - cheapest_total_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -561,11 +602,15 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI */ static void generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_path, - RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, - PathTarget *grouping_target, PathTarget *partial_grouping_target, - bool can_sort, bool can_hash, double d_num_groups, + RelOptInfo *input_rel, RelOptInfo *output_rel, + RelOptInfo *partially_grouped_rel, PathTarget *grouping_target, + PathTarget *partial_grouping_target, bool can_sort, + bool can_hash, double d_num_groups, GroupPathExtraData *extra_data) { + fprintf(stderr, "try generate partial for:\n"); + my_print(cheapest_partial_path); + /* Get subpaths */ List *subpaths = get_subpaths_from_append_path(cheapest_partial_path, false); @@ -597,7 +642,7 @@ generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_pat Assert(get_subpaths_from_append_path(subpath, false) == NIL); add_partially_aggregated_subpaths(root, - cheapest_partial_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -822,6 +867,7 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel Assert(cheapest_total_path != NULL); generate_agg_pushdown_path(root, cheapest_total_path, + input_rel, output_rel, partially_grouped_rel, grouping_target, @@ -837,6 +883,7 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel Path *cheapest_partial_path = linitial(input_rel->partial_pathlist); generate_partial_agg_pushdown_path(root, cheapest_partial_path, + input_rel, output_rel, partially_grouped_rel, grouping_target, @@ -851,6 +898,8 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel if (partially_grouped_rel->pathlist == NIL) return; + fprintf(stderr, "will replan\n"); + /* Prefer our paths */ output_rel->pathlist = NIL; output_rel->partial_pathlist = NIL; @@ -910,6 +959,7 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel d_num_groups)); } } + fprintf(stderr, "replanning done\n"); } /* diff --git a/test/expected/append-15.out b/test/expected/append-15.out index fbf1f113b4a..70598f049c7 100644 --- a/test/expected/append-15.out +++ b/test/expected/append-15.out @@ -322,17 +322,20 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- - GroupAggregate (actual rows=1 loops=1) + Finalize GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Result (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 + -> Custom Scan (ChunkAppend) on append_test (actual rows=2 loops=1) + Order: date_trunc('year'::text, append_test."time") DESC + Chunks excluded during startup: 1 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: date_trunc('year'::text, _hyper_1_3_chunk."time") -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: date_trunc('year'::text, _hyper_1_2_chunk."time") -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(10 rows) +(13 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -398,8 +401,8 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -409,22 +412,29 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Hash (actual rows=3 loops=1) Buckets: 1024 Batches: 1 -> Subquery Scan on data (actual rows=3 loops=1) - -> HashAggregate (actual rows=3 loops=1) - Group Key: time_bucket('@ 30 days'::interval, append_test."time") - Batches: 1 - -> Result (actual rows=5 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=3 loops=1) + Group Key: (time_bucket('@ 30 days'::interval, append_test."time")) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket('@ 30 days'::interval, append_test."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(24 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_1_chunk."time") + -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_2_chunk."time") + -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_3_chunk."time") + -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) +(31 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE diff --git a/test/expected/insert_many.out b/test/expected/insert_many.out index d1f5c1b76aa..a5d24bd05d3 100644 --- a/test/expected/insert_many.out +++ b/test/expected/insert_many.out @@ -44,375 +44,907 @@ INSERT INTO many_partitions_test_1m(time, temp, device) SELECT time_bucket('1 minute', time) AS period, avg(temp), device FROM many_partitions_test GROUP BY period, device; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Custom Scan (HypertableModify) -> Insert on public.many_partitions_test_1m -> Custom Scan (ChunkDispatch) Output: "*SELECT*".period, "*SELECT*".avg, "*SELECT*".device - -> HashAggregate + -> Finalize HashAggregate Output: (time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time")), avg(_hyper_1_1_chunk.temp), _hyper_1_1_chunk.device - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.temp, _hyper_1_1_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.temp, _hyper_1_2_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.temp, _hyper_1_3_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.temp, _hyper_1_4_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_5_chunk."time")), _hyper_1_5_chunk.device, PARTIAL avg(_hyper_1_5_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_5_chunk."time"), _hyper_1_5_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk."time", _hyper_1_5_chunk.temp, _hyper_1_5_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_5_chunk."time"), _hyper_1_5_chunk.device, _hyper_1_5_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_6_chunk."time")), _hyper_1_6_chunk.device, PARTIAL avg(_hyper_1_6_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_6_chunk."time"), _hyper_1_6_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk."time", _hyper_1_6_chunk.temp, _hyper_1_6_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_6_chunk."time"), _hyper_1_6_chunk.device, _hyper_1_6_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_7_chunk."time")), _hyper_1_7_chunk.device, PARTIAL avg(_hyper_1_7_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_7_chunk."time"), _hyper_1_7_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk."time", _hyper_1_7_chunk.temp, _hyper_1_7_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_7_chunk."time"), _hyper_1_7_chunk.device, _hyper_1_7_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_8_chunk."time")), _hyper_1_8_chunk.device, PARTIAL avg(_hyper_1_8_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_8_chunk."time"), _hyper_1_8_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk."time", _hyper_1_8_chunk.temp, _hyper_1_8_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_8_chunk."time"), _hyper_1_8_chunk.device, _hyper_1_8_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_9_chunk."time")), _hyper_1_9_chunk.device, PARTIAL avg(_hyper_1_9_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_9_chunk."time"), _hyper_1_9_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk."time", _hyper_1_9_chunk.temp, _hyper_1_9_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_9_chunk."time"), _hyper_1_9_chunk.device, _hyper_1_9_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_10_chunk."time")), _hyper_1_10_chunk.device, PARTIAL avg(_hyper_1_10_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_10_chunk."time"), _hyper_1_10_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk."time", _hyper_1_10_chunk.temp, _hyper_1_10_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_10_chunk."time"), _hyper_1_10_chunk.device, _hyper_1_10_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_11_chunk."time")), _hyper_1_11_chunk.device, PARTIAL avg(_hyper_1_11_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_11_chunk."time"), _hyper_1_11_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_11_chunk - Output: _hyper_1_11_chunk."time", _hyper_1_11_chunk.temp, _hyper_1_11_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_11_chunk."time"), _hyper_1_11_chunk.device, _hyper_1_11_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_12_chunk."time")), _hyper_1_12_chunk.device, PARTIAL avg(_hyper_1_12_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_12_chunk."time"), _hyper_1_12_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_12_chunk - Output: _hyper_1_12_chunk."time", _hyper_1_12_chunk.temp, _hyper_1_12_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_12_chunk."time"), _hyper_1_12_chunk.device, _hyper_1_12_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_13_chunk."time")), _hyper_1_13_chunk.device, PARTIAL avg(_hyper_1_13_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_13_chunk."time"), _hyper_1_13_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_13_chunk - Output: _hyper_1_13_chunk."time", _hyper_1_13_chunk.temp, _hyper_1_13_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_13_chunk."time"), _hyper_1_13_chunk.device, _hyper_1_13_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_14_chunk."time")), _hyper_1_14_chunk.device, PARTIAL avg(_hyper_1_14_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_14_chunk."time"), _hyper_1_14_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_14_chunk - Output: _hyper_1_14_chunk."time", _hyper_1_14_chunk.temp, _hyper_1_14_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_14_chunk."time"), _hyper_1_14_chunk.device, _hyper_1_14_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_15_chunk."time")), _hyper_1_15_chunk.device, PARTIAL avg(_hyper_1_15_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_15_chunk."time"), _hyper_1_15_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_15_chunk - Output: _hyper_1_15_chunk."time", _hyper_1_15_chunk.temp, _hyper_1_15_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_15_chunk."time"), _hyper_1_15_chunk.device, _hyper_1_15_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_16_chunk."time")), _hyper_1_16_chunk.device, PARTIAL avg(_hyper_1_16_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_16_chunk."time"), _hyper_1_16_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_16_chunk - Output: _hyper_1_16_chunk."time", _hyper_1_16_chunk.temp, _hyper_1_16_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_16_chunk."time"), _hyper_1_16_chunk.device, _hyper_1_16_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_17_chunk."time")), _hyper_1_17_chunk.device, PARTIAL avg(_hyper_1_17_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_17_chunk."time"), _hyper_1_17_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_17_chunk - Output: _hyper_1_17_chunk."time", _hyper_1_17_chunk.temp, _hyper_1_17_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_17_chunk."time"), _hyper_1_17_chunk.device, _hyper_1_17_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_18_chunk."time")), _hyper_1_18_chunk.device, PARTIAL avg(_hyper_1_18_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_18_chunk."time"), _hyper_1_18_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_18_chunk - Output: _hyper_1_18_chunk."time", _hyper_1_18_chunk.temp, _hyper_1_18_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_18_chunk."time"), _hyper_1_18_chunk.device, _hyper_1_18_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_19_chunk."time")), _hyper_1_19_chunk.device, PARTIAL avg(_hyper_1_19_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_19_chunk."time"), _hyper_1_19_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_19_chunk - Output: _hyper_1_19_chunk."time", _hyper_1_19_chunk.temp, _hyper_1_19_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_19_chunk."time"), _hyper_1_19_chunk.device, _hyper_1_19_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_20_chunk."time")), _hyper_1_20_chunk.device, PARTIAL avg(_hyper_1_20_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_20_chunk."time"), _hyper_1_20_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_20_chunk - Output: _hyper_1_20_chunk."time", _hyper_1_20_chunk.temp, _hyper_1_20_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_20_chunk."time"), _hyper_1_20_chunk.device, _hyper_1_20_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_21_chunk."time")), _hyper_1_21_chunk.device, PARTIAL avg(_hyper_1_21_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_21_chunk."time"), _hyper_1_21_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_21_chunk - Output: _hyper_1_21_chunk."time", _hyper_1_21_chunk.temp, _hyper_1_21_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_21_chunk."time"), _hyper_1_21_chunk.device, _hyper_1_21_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_22_chunk."time")), _hyper_1_22_chunk.device, PARTIAL avg(_hyper_1_22_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_22_chunk."time"), _hyper_1_22_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_22_chunk - Output: _hyper_1_22_chunk."time", _hyper_1_22_chunk.temp, _hyper_1_22_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_22_chunk."time"), _hyper_1_22_chunk.device, _hyper_1_22_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_23_chunk."time")), _hyper_1_23_chunk.device, PARTIAL avg(_hyper_1_23_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_23_chunk."time"), _hyper_1_23_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_23_chunk - Output: _hyper_1_23_chunk."time", _hyper_1_23_chunk.temp, _hyper_1_23_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_23_chunk."time"), _hyper_1_23_chunk.device, _hyper_1_23_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_24_chunk."time")), _hyper_1_24_chunk.device, PARTIAL avg(_hyper_1_24_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_24_chunk."time"), _hyper_1_24_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_24_chunk - Output: _hyper_1_24_chunk."time", _hyper_1_24_chunk.temp, _hyper_1_24_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_24_chunk."time"), _hyper_1_24_chunk.device, _hyper_1_24_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_25_chunk."time")), _hyper_1_25_chunk.device, PARTIAL avg(_hyper_1_25_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_25_chunk."time"), _hyper_1_25_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_25_chunk - Output: _hyper_1_25_chunk."time", _hyper_1_25_chunk.temp, _hyper_1_25_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_25_chunk."time"), _hyper_1_25_chunk.device, _hyper_1_25_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_26_chunk."time")), _hyper_1_26_chunk.device, PARTIAL avg(_hyper_1_26_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_26_chunk."time"), _hyper_1_26_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_26_chunk - Output: _hyper_1_26_chunk."time", _hyper_1_26_chunk.temp, _hyper_1_26_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_26_chunk."time"), _hyper_1_26_chunk.device, _hyper_1_26_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_27_chunk."time")), _hyper_1_27_chunk.device, PARTIAL avg(_hyper_1_27_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_27_chunk."time"), _hyper_1_27_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_27_chunk - Output: _hyper_1_27_chunk."time", _hyper_1_27_chunk.temp, _hyper_1_27_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_27_chunk."time"), _hyper_1_27_chunk.device, _hyper_1_27_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_28_chunk."time")), _hyper_1_28_chunk.device, PARTIAL avg(_hyper_1_28_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_28_chunk."time"), _hyper_1_28_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_28_chunk - Output: _hyper_1_28_chunk."time", _hyper_1_28_chunk.temp, _hyper_1_28_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_28_chunk."time"), _hyper_1_28_chunk.device, _hyper_1_28_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_29_chunk."time")), _hyper_1_29_chunk.device, PARTIAL avg(_hyper_1_29_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_29_chunk."time"), _hyper_1_29_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_29_chunk - Output: _hyper_1_29_chunk."time", _hyper_1_29_chunk.temp, _hyper_1_29_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_29_chunk."time"), _hyper_1_29_chunk.device, _hyper_1_29_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_30_chunk."time")), _hyper_1_30_chunk.device, PARTIAL avg(_hyper_1_30_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_30_chunk."time"), _hyper_1_30_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_30_chunk - Output: _hyper_1_30_chunk."time", _hyper_1_30_chunk.temp, _hyper_1_30_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_30_chunk."time"), _hyper_1_30_chunk.device, _hyper_1_30_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_31_chunk."time")), _hyper_1_31_chunk.device, PARTIAL avg(_hyper_1_31_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_31_chunk."time"), _hyper_1_31_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_31_chunk - Output: _hyper_1_31_chunk."time", _hyper_1_31_chunk.temp, _hyper_1_31_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_31_chunk."time"), _hyper_1_31_chunk.device, _hyper_1_31_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_32_chunk."time")), _hyper_1_32_chunk.device, PARTIAL avg(_hyper_1_32_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_32_chunk."time"), _hyper_1_32_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_32_chunk - Output: _hyper_1_32_chunk."time", _hyper_1_32_chunk.temp, _hyper_1_32_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_32_chunk."time"), _hyper_1_32_chunk.device, _hyper_1_32_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_33_chunk."time")), _hyper_1_33_chunk.device, PARTIAL avg(_hyper_1_33_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_33_chunk."time"), _hyper_1_33_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_33_chunk - Output: _hyper_1_33_chunk."time", _hyper_1_33_chunk.temp, _hyper_1_33_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_33_chunk."time"), _hyper_1_33_chunk.device, _hyper_1_33_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_34_chunk."time")), _hyper_1_34_chunk.device, PARTIAL avg(_hyper_1_34_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_34_chunk."time"), _hyper_1_34_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_34_chunk - Output: _hyper_1_34_chunk."time", _hyper_1_34_chunk.temp, _hyper_1_34_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_34_chunk."time"), _hyper_1_34_chunk.device, _hyper_1_34_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_35_chunk."time")), _hyper_1_35_chunk.device, PARTIAL avg(_hyper_1_35_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_35_chunk."time"), _hyper_1_35_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_35_chunk - Output: _hyper_1_35_chunk."time", _hyper_1_35_chunk.temp, _hyper_1_35_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_35_chunk."time"), _hyper_1_35_chunk.device, _hyper_1_35_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_36_chunk."time")), _hyper_1_36_chunk.device, PARTIAL avg(_hyper_1_36_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_36_chunk."time"), _hyper_1_36_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_36_chunk - Output: _hyper_1_36_chunk."time", _hyper_1_36_chunk.temp, _hyper_1_36_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_36_chunk."time"), _hyper_1_36_chunk.device, _hyper_1_36_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_37_chunk."time")), _hyper_1_37_chunk.device, PARTIAL avg(_hyper_1_37_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_37_chunk."time"), _hyper_1_37_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_37_chunk - Output: _hyper_1_37_chunk."time", _hyper_1_37_chunk.temp, _hyper_1_37_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_37_chunk."time"), _hyper_1_37_chunk.device, _hyper_1_37_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_38_chunk."time")), _hyper_1_38_chunk.device, PARTIAL avg(_hyper_1_38_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_38_chunk."time"), _hyper_1_38_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_38_chunk - Output: _hyper_1_38_chunk."time", _hyper_1_38_chunk.temp, _hyper_1_38_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_38_chunk."time"), _hyper_1_38_chunk.device, _hyper_1_38_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_39_chunk."time")), _hyper_1_39_chunk.device, PARTIAL avg(_hyper_1_39_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_39_chunk."time"), _hyper_1_39_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_39_chunk - Output: _hyper_1_39_chunk."time", _hyper_1_39_chunk.temp, _hyper_1_39_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_39_chunk."time"), _hyper_1_39_chunk.device, _hyper_1_39_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_40_chunk."time")), _hyper_1_40_chunk.device, PARTIAL avg(_hyper_1_40_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_40_chunk."time"), _hyper_1_40_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_40_chunk - Output: _hyper_1_40_chunk."time", _hyper_1_40_chunk.temp, _hyper_1_40_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_40_chunk."time"), _hyper_1_40_chunk.device, _hyper_1_40_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_41_chunk."time")), _hyper_1_41_chunk.device, PARTIAL avg(_hyper_1_41_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_41_chunk."time"), _hyper_1_41_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_41_chunk - Output: _hyper_1_41_chunk."time", _hyper_1_41_chunk.temp, _hyper_1_41_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_41_chunk."time"), _hyper_1_41_chunk.device, _hyper_1_41_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_42_chunk."time")), _hyper_1_42_chunk.device, PARTIAL avg(_hyper_1_42_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_42_chunk."time"), _hyper_1_42_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_42_chunk - Output: _hyper_1_42_chunk."time", _hyper_1_42_chunk.temp, _hyper_1_42_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_42_chunk."time"), _hyper_1_42_chunk.device, _hyper_1_42_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_43_chunk."time")), _hyper_1_43_chunk.device, PARTIAL avg(_hyper_1_43_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_43_chunk."time"), _hyper_1_43_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_43_chunk - Output: _hyper_1_43_chunk."time", _hyper_1_43_chunk.temp, _hyper_1_43_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_43_chunk."time"), _hyper_1_43_chunk.device, _hyper_1_43_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_44_chunk."time")), _hyper_1_44_chunk.device, PARTIAL avg(_hyper_1_44_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_44_chunk."time"), _hyper_1_44_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_44_chunk - Output: _hyper_1_44_chunk."time", _hyper_1_44_chunk.temp, _hyper_1_44_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_44_chunk."time"), _hyper_1_44_chunk.device, _hyper_1_44_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_45_chunk."time")), _hyper_1_45_chunk.device, PARTIAL avg(_hyper_1_45_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_45_chunk."time"), _hyper_1_45_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_45_chunk - Output: _hyper_1_45_chunk."time", _hyper_1_45_chunk.temp, _hyper_1_45_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_45_chunk."time"), _hyper_1_45_chunk.device, _hyper_1_45_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_46_chunk."time")), _hyper_1_46_chunk.device, PARTIAL avg(_hyper_1_46_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_46_chunk."time"), _hyper_1_46_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_46_chunk - Output: _hyper_1_46_chunk."time", _hyper_1_46_chunk.temp, _hyper_1_46_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_46_chunk."time"), _hyper_1_46_chunk.device, _hyper_1_46_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_47_chunk."time")), _hyper_1_47_chunk.device, PARTIAL avg(_hyper_1_47_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_47_chunk."time"), _hyper_1_47_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_47_chunk - Output: _hyper_1_47_chunk."time", _hyper_1_47_chunk.temp, _hyper_1_47_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_47_chunk."time"), _hyper_1_47_chunk.device, _hyper_1_47_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_48_chunk."time")), _hyper_1_48_chunk.device, PARTIAL avg(_hyper_1_48_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_48_chunk."time"), _hyper_1_48_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_48_chunk - Output: _hyper_1_48_chunk."time", _hyper_1_48_chunk.temp, _hyper_1_48_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_48_chunk."time"), _hyper_1_48_chunk.device, _hyper_1_48_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_49_chunk."time")), _hyper_1_49_chunk.device, PARTIAL avg(_hyper_1_49_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_49_chunk."time"), _hyper_1_49_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_49_chunk - Output: _hyper_1_49_chunk."time", _hyper_1_49_chunk.temp, _hyper_1_49_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_49_chunk."time"), _hyper_1_49_chunk.device, _hyper_1_49_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_50_chunk."time")), _hyper_1_50_chunk.device, PARTIAL avg(_hyper_1_50_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_50_chunk."time"), _hyper_1_50_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_50_chunk - Output: _hyper_1_50_chunk."time", _hyper_1_50_chunk.temp, _hyper_1_50_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_50_chunk."time"), _hyper_1_50_chunk.device, _hyper_1_50_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_51_chunk."time")), _hyper_1_51_chunk.device, PARTIAL avg(_hyper_1_51_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_51_chunk."time"), _hyper_1_51_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_51_chunk - Output: _hyper_1_51_chunk."time", _hyper_1_51_chunk.temp, _hyper_1_51_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_51_chunk."time"), _hyper_1_51_chunk.device, _hyper_1_51_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_52_chunk."time")), _hyper_1_52_chunk.device, PARTIAL avg(_hyper_1_52_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_52_chunk."time"), _hyper_1_52_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_52_chunk - Output: _hyper_1_52_chunk."time", _hyper_1_52_chunk.temp, _hyper_1_52_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_52_chunk."time"), _hyper_1_52_chunk.device, _hyper_1_52_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_53_chunk."time")), _hyper_1_53_chunk.device, PARTIAL avg(_hyper_1_53_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_53_chunk."time"), _hyper_1_53_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_53_chunk - Output: _hyper_1_53_chunk."time", _hyper_1_53_chunk.temp, _hyper_1_53_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_53_chunk."time"), _hyper_1_53_chunk.device, _hyper_1_53_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_54_chunk."time")), _hyper_1_54_chunk.device, PARTIAL avg(_hyper_1_54_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_54_chunk."time"), _hyper_1_54_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_54_chunk - Output: _hyper_1_54_chunk."time", _hyper_1_54_chunk.temp, _hyper_1_54_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_54_chunk."time"), _hyper_1_54_chunk.device, _hyper_1_54_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_55_chunk."time")), _hyper_1_55_chunk.device, PARTIAL avg(_hyper_1_55_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_55_chunk."time"), _hyper_1_55_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_55_chunk - Output: _hyper_1_55_chunk."time", _hyper_1_55_chunk.temp, _hyper_1_55_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_55_chunk."time"), _hyper_1_55_chunk.device, _hyper_1_55_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_56_chunk."time")), _hyper_1_56_chunk.device, PARTIAL avg(_hyper_1_56_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_56_chunk."time"), _hyper_1_56_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_56_chunk - Output: _hyper_1_56_chunk."time", _hyper_1_56_chunk.temp, _hyper_1_56_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_56_chunk."time"), _hyper_1_56_chunk.device, _hyper_1_56_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_57_chunk."time")), _hyper_1_57_chunk.device, PARTIAL avg(_hyper_1_57_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_57_chunk."time"), _hyper_1_57_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_57_chunk - Output: _hyper_1_57_chunk."time", _hyper_1_57_chunk.temp, _hyper_1_57_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_57_chunk."time"), _hyper_1_57_chunk.device, _hyper_1_57_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_58_chunk."time")), _hyper_1_58_chunk.device, PARTIAL avg(_hyper_1_58_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_58_chunk."time"), _hyper_1_58_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_58_chunk - Output: _hyper_1_58_chunk."time", _hyper_1_58_chunk.temp, _hyper_1_58_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_58_chunk."time"), _hyper_1_58_chunk.device, _hyper_1_58_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_59_chunk."time")), _hyper_1_59_chunk.device, PARTIAL avg(_hyper_1_59_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_59_chunk."time"), _hyper_1_59_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_59_chunk - Output: _hyper_1_59_chunk."time", _hyper_1_59_chunk.temp, _hyper_1_59_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_59_chunk."time"), _hyper_1_59_chunk.device, _hyper_1_59_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_60_chunk."time")), _hyper_1_60_chunk.device, PARTIAL avg(_hyper_1_60_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_60_chunk."time"), _hyper_1_60_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_60_chunk - Output: _hyper_1_60_chunk."time", _hyper_1_60_chunk.temp, _hyper_1_60_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_60_chunk."time"), _hyper_1_60_chunk.device, _hyper_1_60_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_61_chunk."time")), _hyper_1_61_chunk.device, PARTIAL avg(_hyper_1_61_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_61_chunk."time"), _hyper_1_61_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_61_chunk - Output: _hyper_1_61_chunk."time", _hyper_1_61_chunk.temp, _hyper_1_61_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_61_chunk."time"), _hyper_1_61_chunk.device, _hyper_1_61_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_62_chunk."time")), _hyper_1_62_chunk.device, PARTIAL avg(_hyper_1_62_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_62_chunk."time"), _hyper_1_62_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_62_chunk - Output: _hyper_1_62_chunk."time", _hyper_1_62_chunk.temp, _hyper_1_62_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_62_chunk."time"), _hyper_1_62_chunk.device, _hyper_1_62_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_63_chunk."time")), _hyper_1_63_chunk.device, PARTIAL avg(_hyper_1_63_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_63_chunk."time"), _hyper_1_63_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_63_chunk - Output: _hyper_1_63_chunk."time", _hyper_1_63_chunk.temp, _hyper_1_63_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_63_chunk."time"), _hyper_1_63_chunk.device, _hyper_1_63_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_64_chunk."time")), _hyper_1_64_chunk.device, PARTIAL avg(_hyper_1_64_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_64_chunk."time"), _hyper_1_64_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_64_chunk - Output: _hyper_1_64_chunk."time", _hyper_1_64_chunk.temp, _hyper_1_64_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_64_chunk."time"), _hyper_1_64_chunk.device, _hyper_1_64_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_65_chunk."time")), _hyper_1_65_chunk.device, PARTIAL avg(_hyper_1_65_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_65_chunk."time"), _hyper_1_65_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_65_chunk - Output: _hyper_1_65_chunk."time", _hyper_1_65_chunk.temp, _hyper_1_65_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_65_chunk."time"), _hyper_1_65_chunk.device, _hyper_1_65_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_66_chunk."time")), _hyper_1_66_chunk.device, PARTIAL avg(_hyper_1_66_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_66_chunk."time"), _hyper_1_66_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_66_chunk - Output: _hyper_1_66_chunk."time", _hyper_1_66_chunk.temp, _hyper_1_66_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_66_chunk."time"), _hyper_1_66_chunk.device, _hyper_1_66_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_67_chunk."time")), _hyper_1_67_chunk.device, PARTIAL avg(_hyper_1_67_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_67_chunk."time"), _hyper_1_67_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_67_chunk - Output: _hyper_1_67_chunk."time", _hyper_1_67_chunk.temp, _hyper_1_67_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_67_chunk."time"), _hyper_1_67_chunk.device, _hyper_1_67_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_68_chunk."time")), _hyper_1_68_chunk.device, PARTIAL avg(_hyper_1_68_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_68_chunk."time"), _hyper_1_68_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_68_chunk - Output: _hyper_1_68_chunk."time", _hyper_1_68_chunk.temp, _hyper_1_68_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_68_chunk."time"), _hyper_1_68_chunk.device, _hyper_1_68_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_69_chunk."time")), _hyper_1_69_chunk.device, PARTIAL avg(_hyper_1_69_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_69_chunk."time"), _hyper_1_69_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_69_chunk - Output: _hyper_1_69_chunk."time", _hyper_1_69_chunk.temp, _hyper_1_69_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_69_chunk."time"), _hyper_1_69_chunk.device, _hyper_1_69_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_70_chunk."time")), _hyper_1_70_chunk.device, PARTIAL avg(_hyper_1_70_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_70_chunk."time"), _hyper_1_70_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_70_chunk - Output: _hyper_1_70_chunk."time", _hyper_1_70_chunk.temp, _hyper_1_70_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_70_chunk."time"), _hyper_1_70_chunk.device, _hyper_1_70_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_71_chunk."time")), _hyper_1_71_chunk.device, PARTIAL avg(_hyper_1_71_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_71_chunk."time"), _hyper_1_71_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_71_chunk - Output: _hyper_1_71_chunk."time", _hyper_1_71_chunk.temp, _hyper_1_71_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_71_chunk."time"), _hyper_1_71_chunk.device, _hyper_1_71_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_72_chunk."time")), _hyper_1_72_chunk.device, PARTIAL avg(_hyper_1_72_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_72_chunk."time"), _hyper_1_72_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_72_chunk - Output: _hyper_1_72_chunk."time", _hyper_1_72_chunk.temp, _hyper_1_72_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_72_chunk."time"), _hyper_1_72_chunk.device, _hyper_1_72_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_73_chunk."time")), _hyper_1_73_chunk.device, PARTIAL avg(_hyper_1_73_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_73_chunk."time"), _hyper_1_73_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_73_chunk - Output: _hyper_1_73_chunk."time", _hyper_1_73_chunk.temp, _hyper_1_73_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_73_chunk."time"), _hyper_1_73_chunk.device, _hyper_1_73_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_74_chunk."time")), _hyper_1_74_chunk.device, PARTIAL avg(_hyper_1_74_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_74_chunk."time"), _hyper_1_74_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_74_chunk - Output: _hyper_1_74_chunk."time", _hyper_1_74_chunk.temp, _hyper_1_74_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_74_chunk."time"), _hyper_1_74_chunk.device, _hyper_1_74_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_75_chunk."time")), _hyper_1_75_chunk.device, PARTIAL avg(_hyper_1_75_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_75_chunk."time"), _hyper_1_75_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_75_chunk - Output: _hyper_1_75_chunk."time", _hyper_1_75_chunk.temp, _hyper_1_75_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_75_chunk."time"), _hyper_1_75_chunk.device, _hyper_1_75_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_76_chunk."time")), _hyper_1_76_chunk.device, PARTIAL avg(_hyper_1_76_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_76_chunk."time"), _hyper_1_76_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_76_chunk - Output: _hyper_1_76_chunk."time", _hyper_1_76_chunk.temp, _hyper_1_76_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_76_chunk."time"), _hyper_1_76_chunk.device, _hyper_1_76_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_77_chunk."time")), _hyper_1_77_chunk.device, PARTIAL avg(_hyper_1_77_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_77_chunk."time"), _hyper_1_77_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_77_chunk - Output: _hyper_1_77_chunk."time", _hyper_1_77_chunk.temp, _hyper_1_77_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_77_chunk."time"), _hyper_1_77_chunk.device, _hyper_1_77_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_78_chunk."time")), _hyper_1_78_chunk.device, PARTIAL avg(_hyper_1_78_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_78_chunk."time"), _hyper_1_78_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_78_chunk - Output: _hyper_1_78_chunk."time", _hyper_1_78_chunk.temp, _hyper_1_78_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_78_chunk."time"), _hyper_1_78_chunk.device, _hyper_1_78_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_79_chunk."time")), _hyper_1_79_chunk.device, PARTIAL avg(_hyper_1_79_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_79_chunk."time"), _hyper_1_79_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_79_chunk - Output: _hyper_1_79_chunk."time", _hyper_1_79_chunk.temp, _hyper_1_79_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_79_chunk."time"), _hyper_1_79_chunk.device, _hyper_1_79_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_80_chunk."time")), _hyper_1_80_chunk.device, PARTIAL avg(_hyper_1_80_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_80_chunk."time"), _hyper_1_80_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_80_chunk - Output: _hyper_1_80_chunk."time", _hyper_1_80_chunk.temp, _hyper_1_80_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_80_chunk."time"), _hyper_1_80_chunk.device, _hyper_1_80_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_81_chunk."time")), _hyper_1_81_chunk.device, PARTIAL avg(_hyper_1_81_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_81_chunk."time"), _hyper_1_81_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_81_chunk - Output: _hyper_1_81_chunk."time", _hyper_1_81_chunk.temp, _hyper_1_81_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_81_chunk."time"), _hyper_1_81_chunk.device, _hyper_1_81_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_82_chunk."time")), _hyper_1_82_chunk.device, PARTIAL avg(_hyper_1_82_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_82_chunk."time"), _hyper_1_82_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_82_chunk - Output: _hyper_1_82_chunk."time", _hyper_1_82_chunk.temp, _hyper_1_82_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_82_chunk."time"), _hyper_1_82_chunk.device, _hyper_1_82_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_83_chunk."time")), _hyper_1_83_chunk.device, PARTIAL avg(_hyper_1_83_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_83_chunk."time"), _hyper_1_83_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_83_chunk - Output: _hyper_1_83_chunk."time", _hyper_1_83_chunk.temp, _hyper_1_83_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_83_chunk."time"), _hyper_1_83_chunk.device, _hyper_1_83_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_84_chunk."time")), _hyper_1_84_chunk.device, PARTIAL avg(_hyper_1_84_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_84_chunk."time"), _hyper_1_84_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_84_chunk - Output: _hyper_1_84_chunk."time", _hyper_1_84_chunk.temp, _hyper_1_84_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_84_chunk."time"), _hyper_1_84_chunk.device, _hyper_1_84_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_85_chunk."time")), _hyper_1_85_chunk.device, PARTIAL avg(_hyper_1_85_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_85_chunk."time"), _hyper_1_85_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_85_chunk - Output: _hyper_1_85_chunk."time", _hyper_1_85_chunk.temp, _hyper_1_85_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_85_chunk."time"), _hyper_1_85_chunk.device, _hyper_1_85_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_86_chunk."time")), _hyper_1_86_chunk.device, PARTIAL avg(_hyper_1_86_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_86_chunk."time"), _hyper_1_86_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_86_chunk - Output: _hyper_1_86_chunk."time", _hyper_1_86_chunk.temp, _hyper_1_86_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_86_chunk."time"), _hyper_1_86_chunk.device, _hyper_1_86_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_87_chunk."time")), _hyper_1_87_chunk.device, PARTIAL avg(_hyper_1_87_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_87_chunk."time"), _hyper_1_87_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_87_chunk - Output: _hyper_1_87_chunk."time", _hyper_1_87_chunk.temp, _hyper_1_87_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_87_chunk."time"), _hyper_1_87_chunk.device, _hyper_1_87_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_88_chunk."time")), _hyper_1_88_chunk.device, PARTIAL avg(_hyper_1_88_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_88_chunk."time"), _hyper_1_88_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_88_chunk - Output: _hyper_1_88_chunk."time", _hyper_1_88_chunk.temp, _hyper_1_88_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_88_chunk."time"), _hyper_1_88_chunk.device, _hyper_1_88_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_89_chunk."time")), _hyper_1_89_chunk.device, PARTIAL avg(_hyper_1_89_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_89_chunk."time"), _hyper_1_89_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_89_chunk - Output: _hyper_1_89_chunk."time", _hyper_1_89_chunk.temp, _hyper_1_89_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_89_chunk."time"), _hyper_1_89_chunk.device, _hyper_1_89_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_90_chunk."time")), _hyper_1_90_chunk.device, PARTIAL avg(_hyper_1_90_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_90_chunk."time"), _hyper_1_90_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_90_chunk - Output: _hyper_1_90_chunk."time", _hyper_1_90_chunk.temp, _hyper_1_90_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_90_chunk."time"), _hyper_1_90_chunk.device, _hyper_1_90_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_91_chunk."time")), _hyper_1_91_chunk.device, PARTIAL avg(_hyper_1_91_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_91_chunk."time"), _hyper_1_91_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_91_chunk - Output: _hyper_1_91_chunk."time", _hyper_1_91_chunk.temp, _hyper_1_91_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_91_chunk."time"), _hyper_1_91_chunk.device, _hyper_1_91_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_92_chunk."time")), _hyper_1_92_chunk.device, PARTIAL avg(_hyper_1_92_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_92_chunk."time"), _hyper_1_92_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_92_chunk - Output: _hyper_1_92_chunk."time", _hyper_1_92_chunk.temp, _hyper_1_92_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_92_chunk."time"), _hyper_1_92_chunk.device, _hyper_1_92_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_93_chunk."time")), _hyper_1_93_chunk.device, PARTIAL avg(_hyper_1_93_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_93_chunk."time"), _hyper_1_93_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_93_chunk - Output: _hyper_1_93_chunk."time", _hyper_1_93_chunk.temp, _hyper_1_93_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_93_chunk."time"), _hyper_1_93_chunk.device, _hyper_1_93_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_94_chunk."time")), _hyper_1_94_chunk.device, PARTIAL avg(_hyper_1_94_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_94_chunk."time"), _hyper_1_94_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_94_chunk - Output: _hyper_1_94_chunk."time", _hyper_1_94_chunk.temp, _hyper_1_94_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_94_chunk."time"), _hyper_1_94_chunk.device, _hyper_1_94_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_95_chunk."time")), _hyper_1_95_chunk.device, PARTIAL avg(_hyper_1_95_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_95_chunk."time"), _hyper_1_95_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_95_chunk - Output: _hyper_1_95_chunk."time", _hyper_1_95_chunk.temp, _hyper_1_95_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_95_chunk."time"), _hyper_1_95_chunk.device, _hyper_1_95_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_96_chunk."time")), _hyper_1_96_chunk.device, PARTIAL avg(_hyper_1_96_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_96_chunk."time"), _hyper_1_96_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_96_chunk - Output: _hyper_1_96_chunk."time", _hyper_1_96_chunk.temp, _hyper_1_96_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_96_chunk."time"), _hyper_1_96_chunk.device, _hyper_1_96_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_97_chunk."time")), _hyper_1_97_chunk.device, PARTIAL avg(_hyper_1_97_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_97_chunk."time"), _hyper_1_97_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_97_chunk - Output: _hyper_1_97_chunk."time", _hyper_1_97_chunk.temp, _hyper_1_97_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_97_chunk."time"), _hyper_1_97_chunk.device, _hyper_1_97_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_98_chunk."time")), _hyper_1_98_chunk.device, PARTIAL avg(_hyper_1_98_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_98_chunk."time"), _hyper_1_98_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_98_chunk - Output: _hyper_1_98_chunk."time", _hyper_1_98_chunk.temp, _hyper_1_98_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_98_chunk."time"), _hyper_1_98_chunk.device, _hyper_1_98_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_99_chunk."time")), _hyper_1_99_chunk.device, PARTIAL avg(_hyper_1_99_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_99_chunk."time"), _hyper_1_99_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_99_chunk - Output: _hyper_1_99_chunk."time", _hyper_1_99_chunk.temp, _hyper_1_99_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_99_chunk."time"), _hyper_1_99_chunk.device, _hyper_1_99_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_100_chunk."time")), _hyper_1_100_chunk.device, PARTIAL avg(_hyper_1_100_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_100_chunk."time"), _hyper_1_100_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_100_chunk - Output: _hyper_1_100_chunk."time", _hyper_1_100_chunk.temp, _hyper_1_100_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_100_chunk."time"), _hyper_1_100_chunk.device, _hyper_1_100_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_101_chunk."time")), _hyper_1_101_chunk.device, PARTIAL avg(_hyper_1_101_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_101_chunk."time"), _hyper_1_101_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_101_chunk - Output: _hyper_1_101_chunk."time", _hyper_1_101_chunk.temp, _hyper_1_101_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_101_chunk."time"), _hyper_1_101_chunk.device, _hyper_1_101_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_102_chunk."time")), _hyper_1_102_chunk.device, PARTIAL avg(_hyper_1_102_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_102_chunk."time"), _hyper_1_102_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_102_chunk - Output: _hyper_1_102_chunk."time", _hyper_1_102_chunk.temp, _hyper_1_102_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_102_chunk."time"), _hyper_1_102_chunk.device, _hyper_1_102_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_103_chunk."time")), _hyper_1_103_chunk.device, PARTIAL avg(_hyper_1_103_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_103_chunk."time"), _hyper_1_103_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_103_chunk - Output: _hyper_1_103_chunk."time", _hyper_1_103_chunk.temp, _hyper_1_103_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_103_chunk."time"), _hyper_1_103_chunk.device, _hyper_1_103_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_104_chunk."time")), _hyper_1_104_chunk.device, PARTIAL avg(_hyper_1_104_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_104_chunk."time"), _hyper_1_104_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_104_chunk - Output: _hyper_1_104_chunk."time", _hyper_1_104_chunk.temp, _hyper_1_104_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_104_chunk."time"), _hyper_1_104_chunk.device, _hyper_1_104_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_105_chunk."time")), _hyper_1_105_chunk.device, PARTIAL avg(_hyper_1_105_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_105_chunk."time"), _hyper_1_105_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_105_chunk - Output: _hyper_1_105_chunk."time", _hyper_1_105_chunk.temp, _hyper_1_105_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_105_chunk."time"), _hyper_1_105_chunk.device, _hyper_1_105_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_106_chunk."time")), _hyper_1_106_chunk.device, PARTIAL avg(_hyper_1_106_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_106_chunk."time"), _hyper_1_106_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_106_chunk - Output: _hyper_1_106_chunk."time", _hyper_1_106_chunk.temp, _hyper_1_106_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_106_chunk."time"), _hyper_1_106_chunk.device, _hyper_1_106_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_107_chunk."time")), _hyper_1_107_chunk.device, PARTIAL avg(_hyper_1_107_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_107_chunk."time"), _hyper_1_107_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_107_chunk - Output: _hyper_1_107_chunk."time", _hyper_1_107_chunk.temp, _hyper_1_107_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_107_chunk."time"), _hyper_1_107_chunk.device, _hyper_1_107_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_108_chunk."time")), _hyper_1_108_chunk.device, PARTIAL avg(_hyper_1_108_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_108_chunk."time"), _hyper_1_108_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_108_chunk - Output: _hyper_1_108_chunk."time", _hyper_1_108_chunk.temp, _hyper_1_108_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_108_chunk."time"), _hyper_1_108_chunk.device, _hyper_1_108_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_109_chunk."time")), _hyper_1_109_chunk.device, PARTIAL avg(_hyper_1_109_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_109_chunk."time"), _hyper_1_109_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_109_chunk - Output: _hyper_1_109_chunk."time", _hyper_1_109_chunk.temp, _hyper_1_109_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_109_chunk."time"), _hyper_1_109_chunk.device, _hyper_1_109_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_110_chunk."time")), _hyper_1_110_chunk.device, PARTIAL avg(_hyper_1_110_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_110_chunk."time"), _hyper_1_110_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_110_chunk - Output: _hyper_1_110_chunk."time", _hyper_1_110_chunk.temp, _hyper_1_110_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_110_chunk."time"), _hyper_1_110_chunk.device, _hyper_1_110_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_111_chunk."time")), _hyper_1_111_chunk.device, PARTIAL avg(_hyper_1_111_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_111_chunk."time"), _hyper_1_111_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_111_chunk - Output: _hyper_1_111_chunk."time", _hyper_1_111_chunk.temp, _hyper_1_111_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_111_chunk."time"), _hyper_1_111_chunk.device, _hyper_1_111_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_112_chunk."time")), _hyper_1_112_chunk.device, PARTIAL avg(_hyper_1_112_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_112_chunk."time"), _hyper_1_112_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_112_chunk - Output: _hyper_1_112_chunk."time", _hyper_1_112_chunk.temp, _hyper_1_112_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_112_chunk."time"), _hyper_1_112_chunk.device, _hyper_1_112_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_113_chunk."time")), _hyper_1_113_chunk.device, PARTIAL avg(_hyper_1_113_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_113_chunk."time"), _hyper_1_113_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_113_chunk - Output: _hyper_1_113_chunk."time", _hyper_1_113_chunk.temp, _hyper_1_113_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_113_chunk."time"), _hyper_1_113_chunk.device, _hyper_1_113_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_114_chunk."time")), _hyper_1_114_chunk.device, PARTIAL avg(_hyper_1_114_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_114_chunk."time"), _hyper_1_114_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_114_chunk - Output: _hyper_1_114_chunk."time", _hyper_1_114_chunk.temp, _hyper_1_114_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_114_chunk."time"), _hyper_1_114_chunk.device, _hyper_1_114_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_115_chunk."time")), _hyper_1_115_chunk.device, PARTIAL avg(_hyper_1_115_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_115_chunk."time"), _hyper_1_115_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_115_chunk - Output: _hyper_1_115_chunk."time", _hyper_1_115_chunk.temp, _hyper_1_115_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_115_chunk."time"), _hyper_1_115_chunk.device, _hyper_1_115_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_116_chunk."time")), _hyper_1_116_chunk.device, PARTIAL avg(_hyper_1_116_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_116_chunk."time"), _hyper_1_116_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_116_chunk - Output: _hyper_1_116_chunk."time", _hyper_1_116_chunk.temp, _hyper_1_116_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_116_chunk."time"), _hyper_1_116_chunk.device, _hyper_1_116_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_117_chunk."time")), _hyper_1_117_chunk.device, PARTIAL avg(_hyper_1_117_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_117_chunk."time"), _hyper_1_117_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_117_chunk - Output: _hyper_1_117_chunk."time", _hyper_1_117_chunk.temp, _hyper_1_117_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_117_chunk."time"), _hyper_1_117_chunk.device, _hyper_1_117_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_118_chunk."time")), _hyper_1_118_chunk.device, PARTIAL avg(_hyper_1_118_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_118_chunk."time"), _hyper_1_118_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_118_chunk - Output: _hyper_1_118_chunk."time", _hyper_1_118_chunk.temp, _hyper_1_118_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_118_chunk."time"), _hyper_1_118_chunk.device, _hyper_1_118_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_119_chunk."time")), _hyper_1_119_chunk.device, PARTIAL avg(_hyper_1_119_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_119_chunk."time"), _hyper_1_119_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_119_chunk - Output: _hyper_1_119_chunk."time", _hyper_1_119_chunk.temp, _hyper_1_119_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_119_chunk."time"), _hyper_1_119_chunk.device, _hyper_1_119_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_120_chunk."time")), _hyper_1_120_chunk.device, PARTIAL avg(_hyper_1_120_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_120_chunk."time"), _hyper_1_120_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_120_chunk - Output: _hyper_1_120_chunk."time", _hyper_1_120_chunk.temp, _hyper_1_120_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_120_chunk."time"), _hyper_1_120_chunk.device, _hyper_1_120_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_121_chunk."time")), _hyper_1_121_chunk.device, PARTIAL avg(_hyper_1_121_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_121_chunk."time"), _hyper_1_121_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_121_chunk - Output: _hyper_1_121_chunk."time", _hyper_1_121_chunk.temp, _hyper_1_121_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_121_chunk."time"), _hyper_1_121_chunk.device, _hyper_1_121_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_122_chunk."time")), _hyper_1_122_chunk.device, PARTIAL avg(_hyper_1_122_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_122_chunk."time"), _hyper_1_122_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_122_chunk - Output: _hyper_1_122_chunk."time", _hyper_1_122_chunk.temp, _hyper_1_122_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_122_chunk."time"), _hyper_1_122_chunk.device, _hyper_1_122_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_123_chunk."time")), _hyper_1_123_chunk.device, PARTIAL avg(_hyper_1_123_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_123_chunk."time"), _hyper_1_123_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_123_chunk - Output: _hyper_1_123_chunk."time", _hyper_1_123_chunk.temp, _hyper_1_123_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_123_chunk."time"), _hyper_1_123_chunk.device, _hyper_1_123_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_124_chunk."time")), _hyper_1_124_chunk.device, PARTIAL avg(_hyper_1_124_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_124_chunk."time"), _hyper_1_124_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_124_chunk - Output: _hyper_1_124_chunk."time", _hyper_1_124_chunk.temp, _hyper_1_124_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_124_chunk."time"), _hyper_1_124_chunk.device, _hyper_1_124_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_125_chunk."time")), _hyper_1_125_chunk.device, PARTIAL avg(_hyper_1_125_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_125_chunk."time"), _hyper_1_125_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_125_chunk - Output: _hyper_1_125_chunk."time", _hyper_1_125_chunk.temp, _hyper_1_125_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_125_chunk."time"), _hyper_1_125_chunk.device, _hyper_1_125_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_126_chunk."time")), _hyper_1_126_chunk.device, PARTIAL avg(_hyper_1_126_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_126_chunk."time"), _hyper_1_126_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_126_chunk - Output: _hyper_1_126_chunk."time", _hyper_1_126_chunk.temp, _hyper_1_126_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_126_chunk."time"), _hyper_1_126_chunk.device, _hyper_1_126_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_127_chunk."time")), _hyper_1_127_chunk.device, PARTIAL avg(_hyper_1_127_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_127_chunk."time"), _hyper_1_127_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_127_chunk - Output: _hyper_1_127_chunk."time", _hyper_1_127_chunk.temp, _hyper_1_127_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_127_chunk."time"), _hyper_1_127_chunk.device, _hyper_1_127_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_128_chunk."time")), _hyper_1_128_chunk.device, PARTIAL avg(_hyper_1_128_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_128_chunk."time"), _hyper_1_128_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_128_chunk - Output: _hyper_1_128_chunk."time", _hyper_1_128_chunk.temp, _hyper_1_128_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_128_chunk."time"), _hyper_1_128_chunk.device, _hyper_1_128_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_129_chunk."time")), _hyper_1_129_chunk.device, PARTIAL avg(_hyper_1_129_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_129_chunk."time"), _hyper_1_129_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_129_chunk - Output: _hyper_1_129_chunk."time", _hyper_1_129_chunk.temp, _hyper_1_129_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_129_chunk."time"), _hyper_1_129_chunk.device, _hyper_1_129_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_130_chunk."time")), _hyper_1_130_chunk.device, PARTIAL avg(_hyper_1_130_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_130_chunk."time"), _hyper_1_130_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_130_chunk - Output: _hyper_1_130_chunk."time", _hyper_1_130_chunk.temp, _hyper_1_130_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_130_chunk."time"), _hyper_1_130_chunk.device, _hyper_1_130_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_131_chunk."time")), _hyper_1_131_chunk.device, PARTIAL avg(_hyper_1_131_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_131_chunk."time"), _hyper_1_131_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_131_chunk - Output: _hyper_1_131_chunk."time", _hyper_1_131_chunk.temp, _hyper_1_131_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_131_chunk."time"), _hyper_1_131_chunk.device, _hyper_1_131_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_132_chunk."time")), _hyper_1_132_chunk.device, PARTIAL avg(_hyper_1_132_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_132_chunk."time"), _hyper_1_132_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_132_chunk - Output: _hyper_1_132_chunk."time", _hyper_1_132_chunk.temp, _hyper_1_132_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_132_chunk."time"), _hyper_1_132_chunk.device, _hyper_1_132_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_133_chunk."time")), _hyper_1_133_chunk.device, PARTIAL avg(_hyper_1_133_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_133_chunk."time"), _hyper_1_133_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_133_chunk - Output: _hyper_1_133_chunk."time", _hyper_1_133_chunk.temp, _hyper_1_133_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_133_chunk."time"), _hyper_1_133_chunk.device, _hyper_1_133_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_134_chunk."time")), _hyper_1_134_chunk.device, PARTIAL avg(_hyper_1_134_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_134_chunk."time"), _hyper_1_134_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_134_chunk - Output: _hyper_1_134_chunk."time", _hyper_1_134_chunk.temp, _hyper_1_134_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_134_chunk."time"), _hyper_1_134_chunk.device, _hyper_1_134_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_135_chunk."time")), _hyper_1_135_chunk.device, PARTIAL avg(_hyper_1_135_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_135_chunk."time"), _hyper_1_135_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_135_chunk - Output: _hyper_1_135_chunk."time", _hyper_1_135_chunk.temp, _hyper_1_135_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_135_chunk."time"), _hyper_1_135_chunk.device, _hyper_1_135_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_136_chunk."time")), _hyper_1_136_chunk.device, PARTIAL avg(_hyper_1_136_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_136_chunk."time"), _hyper_1_136_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_136_chunk - Output: _hyper_1_136_chunk."time", _hyper_1_136_chunk.temp, _hyper_1_136_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_136_chunk."time"), _hyper_1_136_chunk.device, _hyper_1_136_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_137_chunk."time")), _hyper_1_137_chunk.device, PARTIAL avg(_hyper_1_137_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_137_chunk."time"), _hyper_1_137_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_137_chunk - Output: _hyper_1_137_chunk."time", _hyper_1_137_chunk.temp, _hyper_1_137_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_137_chunk."time"), _hyper_1_137_chunk.device, _hyper_1_137_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_138_chunk."time")), _hyper_1_138_chunk.device, PARTIAL avg(_hyper_1_138_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_138_chunk."time"), _hyper_1_138_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_138_chunk - Output: _hyper_1_138_chunk."time", _hyper_1_138_chunk.temp, _hyper_1_138_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_138_chunk."time"), _hyper_1_138_chunk.device, _hyper_1_138_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_139_chunk."time")), _hyper_1_139_chunk.device, PARTIAL avg(_hyper_1_139_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_139_chunk."time"), _hyper_1_139_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_139_chunk - Output: _hyper_1_139_chunk."time", _hyper_1_139_chunk.temp, _hyper_1_139_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_139_chunk."time"), _hyper_1_139_chunk.device, _hyper_1_139_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_140_chunk."time")), _hyper_1_140_chunk.device, PARTIAL avg(_hyper_1_140_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_140_chunk."time"), _hyper_1_140_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_140_chunk - Output: _hyper_1_140_chunk."time", _hyper_1_140_chunk.temp, _hyper_1_140_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_140_chunk."time"), _hyper_1_140_chunk.device, _hyper_1_140_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_141_chunk."time")), _hyper_1_141_chunk.device, PARTIAL avg(_hyper_1_141_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_141_chunk."time"), _hyper_1_141_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_141_chunk - Output: _hyper_1_141_chunk."time", _hyper_1_141_chunk.temp, _hyper_1_141_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_141_chunk."time"), _hyper_1_141_chunk.device, _hyper_1_141_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_142_chunk."time")), _hyper_1_142_chunk.device, PARTIAL avg(_hyper_1_142_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_142_chunk."time"), _hyper_1_142_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_142_chunk - Output: _hyper_1_142_chunk."time", _hyper_1_142_chunk.temp, _hyper_1_142_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_142_chunk."time"), _hyper_1_142_chunk.device, _hyper_1_142_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_143_chunk."time")), _hyper_1_143_chunk.device, PARTIAL avg(_hyper_1_143_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_143_chunk."time"), _hyper_1_143_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_143_chunk - Output: _hyper_1_143_chunk."time", _hyper_1_143_chunk.temp, _hyper_1_143_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_143_chunk."time"), _hyper_1_143_chunk.device, _hyper_1_143_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_144_chunk."time")), _hyper_1_144_chunk.device, PARTIAL avg(_hyper_1_144_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_144_chunk."time"), _hyper_1_144_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_144_chunk - Output: _hyper_1_144_chunk."time", _hyper_1_144_chunk.temp, _hyper_1_144_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_144_chunk."time"), _hyper_1_144_chunk.device, _hyper_1_144_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_145_chunk."time")), _hyper_1_145_chunk.device, PARTIAL avg(_hyper_1_145_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_145_chunk."time"), _hyper_1_145_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_145_chunk - Output: _hyper_1_145_chunk."time", _hyper_1_145_chunk.temp, _hyper_1_145_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_145_chunk."time"), _hyper_1_145_chunk.device, _hyper_1_145_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_146_chunk."time")), _hyper_1_146_chunk.device, PARTIAL avg(_hyper_1_146_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_146_chunk."time"), _hyper_1_146_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_146_chunk - Output: _hyper_1_146_chunk."time", _hyper_1_146_chunk.temp, _hyper_1_146_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_146_chunk."time"), _hyper_1_146_chunk.device, _hyper_1_146_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_147_chunk."time")), _hyper_1_147_chunk.device, PARTIAL avg(_hyper_1_147_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_147_chunk."time"), _hyper_1_147_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_147_chunk - Output: _hyper_1_147_chunk."time", _hyper_1_147_chunk.temp, _hyper_1_147_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_147_chunk."time"), _hyper_1_147_chunk.device, _hyper_1_147_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_148_chunk."time")), _hyper_1_148_chunk.device, PARTIAL avg(_hyper_1_148_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_148_chunk."time"), _hyper_1_148_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_148_chunk - Output: _hyper_1_148_chunk."time", _hyper_1_148_chunk.temp, _hyper_1_148_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_148_chunk."time"), _hyper_1_148_chunk.device, _hyper_1_148_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_149_chunk."time")), _hyper_1_149_chunk.device, PARTIAL avg(_hyper_1_149_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_149_chunk."time"), _hyper_1_149_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_149_chunk - Output: _hyper_1_149_chunk."time", _hyper_1_149_chunk.temp, _hyper_1_149_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_149_chunk."time"), _hyper_1_149_chunk.device, _hyper_1_149_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_150_chunk."time")), _hyper_1_150_chunk.device, PARTIAL avg(_hyper_1_150_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_150_chunk."time"), _hyper_1_150_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_150_chunk - Output: _hyper_1_150_chunk."time", _hyper_1_150_chunk.temp, _hyper_1_150_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_150_chunk."time"), _hyper_1_150_chunk.device, _hyper_1_150_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_151_chunk."time")), _hyper_1_151_chunk.device, PARTIAL avg(_hyper_1_151_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_151_chunk."time"), _hyper_1_151_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_151_chunk - Output: _hyper_1_151_chunk."time", _hyper_1_151_chunk.temp, _hyper_1_151_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_151_chunk."time"), _hyper_1_151_chunk.device, _hyper_1_151_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_152_chunk."time")), _hyper_1_152_chunk.device, PARTIAL avg(_hyper_1_152_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_152_chunk."time"), _hyper_1_152_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_152_chunk - Output: _hyper_1_152_chunk."time", _hyper_1_152_chunk.temp, _hyper_1_152_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_152_chunk."time"), _hyper_1_152_chunk.device, _hyper_1_152_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_153_chunk."time")), _hyper_1_153_chunk.device, PARTIAL avg(_hyper_1_153_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_153_chunk."time"), _hyper_1_153_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_153_chunk - Output: _hyper_1_153_chunk."time", _hyper_1_153_chunk.temp, _hyper_1_153_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_153_chunk."time"), _hyper_1_153_chunk.device, _hyper_1_153_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_154_chunk."time")), _hyper_1_154_chunk.device, PARTIAL avg(_hyper_1_154_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_154_chunk."time"), _hyper_1_154_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_154_chunk - Output: _hyper_1_154_chunk."time", _hyper_1_154_chunk.temp, _hyper_1_154_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_154_chunk."time"), _hyper_1_154_chunk.device, _hyper_1_154_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_155_chunk."time")), _hyper_1_155_chunk.device, PARTIAL avg(_hyper_1_155_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_155_chunk."time"), _hyper_1_155_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_155_chunk - Output: _hyper_1_155_chunk."time", _hyper_1_155_chunk.temp, _hyper_1_155_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_155_chunk."time"), _hyper_1_155_chunk.device, _hyper_1_155_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_156_chunk."time")), _hyper_1_156_chunk.device, PARTIAL avg(_hyper_1_156_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_156_chunk."time"), _hyper_1_156_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_156_chunk - Output: _hyper_1_156_chunk."time", _hyper_1_156_chunk.temp, _hyper_1_156_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_156_chunk."time"), _hyper_1_156_chunk.device, _hyper_1_156_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_157_chunk."time")), _hyper_1_157_chunk.device, PARTIAL avg(_hyper_1_157_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_157_chunk."time"), _hyper_1_157_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_157_chunk - Output: _hyper_1_157_chunk."time", _hyper_1_157_chunk.temp, _hyper_1_157_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_157_chunk."time"), _hyper_1_157_chunk.device, _hyper_1_157_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_158_chunk."time")), _hyper_1_158_chunk.device, PARTIAL avg(_hyper_1_158_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_158_chunk."time"), _hyper_1_158_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_158_chunk - Output: _hyper_1_158_chunk."time", _hyper_1_158_chunk.temp, _hyper_1_158_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_158_chunk."time"), _hyper_1_158_chunk.device, _hyper_1_158_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_159_chunk."time")), _hyper_1_159_chunk.device, PARTIAL avg(_hyper_1_159_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_159_chunk."time"), _hyper_1_159_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_159_chunk - Output: _hyper_1_159_chunk."time", _hyper_1_159_chunk.temp, _hyper_1_159_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_159_chunk."time"), _hyper_1_159_chunk.device, _hyper_1_159_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_160_chunk."time")), _hyper_1_160_chunk.device, PARTIAL avg(_hyper_1_160_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_160_chunk."time"), _hyper_1_160_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_160_chunk - Output: _hyper_1_160_chunk."time", _hyper_1_160_chunk.temp, _hyper_1_160_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_160_chunk."time"), _hyper_1_160_chunk.device, _hyper_1_160_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_161_chunk."time")), _hyper_1_161_chunk.device, PARTIAL avg(_hyper_1_161_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_161_chunk."time"), _hyper_1_161_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_161_chunk - Output: _hyper_1_161_chunk."time", _hyper_1_161_chunk.temp, _hyper_1_161_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_161_chunk."time"), _hyper_1_161_chunk.device, _hyper_1_161_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_162_chunk."time")), _hyper_1_162_chunk.device, PARTIAL avg(_hyper_1_162_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_162_chunk."time"), _hyper_1_162_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_162_chunk - Output: _hyper_1_162_chunk."time", _hyper_1_162_chunk.temp, _hyper_1_162_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_162_chunk."time"), _hyper_1_162_chunk.device, _hyper_1_162_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_163_chunk."time")), _hyper_1_163_chunk.device, PARTIAL avg(_hyper_1_163_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_163_chunk."time"), _hyper_1_163_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_163_chunk - Output: _hyper_1_163_chunk."time", _hyper_1_163_chunk.temp, _hyper_1_163_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_163_chunk."time"), _hyper_1_163_chunk.device, _hyper_1_163_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_164_chunk."time")), _hyper_1_164_chunk.device, PARTIAL avg(_hyper_1_164_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_164_chunk."time"), _hyper_1_164_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_164_chunk - Output: _hyper_1_164_chunk."time", _hyper_1_164_chunk.temp, _hyper_1_164_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_164_chunk."time"), _hyper_1_164_chunk.device, _hyper_1_164_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_165_chunk."time")), _hyper_1_165_chunk.device, PARTIAL avg(_hyper_1_165_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_165_chunk."time"), _hyper_1_165_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_165_chunk - Output: _hyper_1_165_chunk."time", _hyper_1_165_chunk.temp, _hyper_1_165_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_165_chunk."time"), _hyper_1_165_chunk.device, _hyper_1_165_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_166_chunk."time")), _hyper_1_166_chunk.device, PARTIAL avg(_hyper_1_166_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_166_chunk."time"), _hyper_1_166_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_166_chunk - Output: _hyper_1_166_chunk."time", _hyper_1_166_chunk.temp, _hyper_1_166_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_166_chunk."time"), _hyper_1_166_chunk.device, _hyper_1_166_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_167_chunk."time")), _hyper_1_167_chunk.device, PARTIAL avg(_hyper_1_167_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_167_chunk."time"), _hyper_1_167_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_167_chunk - Output: _hyper_1_167_chunk."time", _hyper_1_167_chunk.temp, _hyper_1_167_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_167_chunk."time"), _hyper_1_167_chunk.device, _hyper_1_167_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_168_chunk."time")), _hyper_1_168_chunk.device, PARTIAL avg(_hyper_1_168_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_168_chunk."time"), _hyper_1_168_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_168_chunk - Output: _hyper_1_168_chunk."time", _hyper_1_168_chunk.temp, _hyper_1_168_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_168_chunk."time"), _hyper_1_168_chunk.device, _hyper_1_168_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_169_chunk."time")), _hyper_1_169_chunk.device, PARTIAL avg(_hyper_1_169_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_169_chunk."time"), _hyper_1_169_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_169_chunk - Output: _hyper_1_169_chunk."time", _hyper_1_169_chunk.temp, _hyper_1_169_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_169_chunk."time"), _hyper_1_169_chunk.device, _hyper_1_169_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_170_chunk."time")), _hyper_1_170_chunk.device, PARTIAL avg(_hyper_1_170_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_170_chunk."time"), _hyper_1_170_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_170_chunk - Output: _hyper_1_170_chunk."time", _hyper_1_170_chunk.temp, _hyper_1_170_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_170_chunk."time"), _hyper_1_170_chunk.device, _hyper_1_170_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_171_chunk."time")), _hyper_1_171_chunk.device, PARTIAL avg(_hyper_1_171_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_171_chunk."time"), _hyper_1_171_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_171_chunk - Output: _hyper_1_171_chunk."time", _hyper_1_171_chunk.temp, _hyper_1_171_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_171_chunk."time"), _hyper_1_171_chunk.device, _hyper_1_171_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_172_chunk."time")), _hyper_1_172_chunk.device, PARTIAL avg(_hyper_1_172_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_172_chunk."time"), _hyper_1_172_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_172_chunk - Output: _hyper_1_172_chunk."time", _hyper_1_172_chunk.temp, _hyper_1_172_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_172_chunk."time"), _hyper_1_172_chunk.device, _hyper_1_172_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_173_chunk."time")), _hyper_1_173_chunk.device, PARTIAL avg(_hyper_1_173_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_173_chunk."time"), _hyper_1_173_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_173_chunk - Output: _hyper_1_173_chunk."time", _hyper_1_173_chunk.temp, _hyper_1_173_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_173_chunk."time"), _hyper_1_173_chunk.device, _hyper_1_173_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_174_chunk."time")), _hyper_1_174_chunk.device, PARTIAL avg(_hyper_1_174_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_174_chunk."time"), _hyper_1_174_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_174_chunk - Output: _hyper_1_174_chunk."time", _hyper_1_174_chunk.temp, _hyper_1_174_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_174_chunk."time"), _hyper_1_174_chunk.device, _hyper_1_174_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_175_chunk."time")), _hyper_1_175_chunk.device, PARTIAL avg(_hyper_1_175_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_175_chunk."time"), _hyper_1_175_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_175_chunk - Output: _hyper_1_175_chunk."time", _hyper_1_175_chunk.temp, _hyper_1_175_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_175_chunk."time"), _hyper_1_175_chunk.device, _hyper_1_175_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_176_chunk."time")), _hyper_1_176_chunk.device, PARTIAL avg(_hyper_1_176_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_176_chunk."time"), _hyper_1_176_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_176_chunk - Output: _hyper_1_176_chunk."time", _hyper_1_176_chunk.temp, _hyper_1_176_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_176_chunk."time"), _hyper_1_176_chunk.device, _hyper_1_176_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_177_chunk."time")), _hyper_1_177_chunk.device, PARTIAL avg(_hyper_1_177_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_177_chunk."time"), _hyper_1_177_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_177_chunk - Output: _hyper_1_177_chunk."time", _hyper_1_177_chunk.temp, _hyper_1_177_chunk.device + Output: time_bucket('@ 1 min'::interval, _hyper_1_177_chunk."time"), _hyper_1_177_chunk.device, _hyper_1_177_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 min'::interval, _hyper_1_178_chunk."time")), _hyper_1_178_chunk.device, PARTIAL avg(_hyper_1_178_chunk.temp) + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_178_chunk."time"), _hyper_1_178_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_178_chunk - Output: _hyper_1_178_chunk."time", _hyper_1_178_chunk.temp, _hyper_1_178_chunk.device -(366 rows) + Output: time_bucket('@ 1 min'::interval, _hyper_1_178_chunk."time"), _hyper_1_178_chunk.device, _hyper_1_178_chunk.temp +(898 rows) INSERT INTO many_partitions_test_1m(time, temp, device) SELECT time_bucket('1 minute', time) AS period, avg(temp), device diff --git a/test/expected/partitionwise-15.out b/test/expected/partitionwise-15.out index ea178ed5813..9c3b291b802 100644 --- a/test/expected/partitionwise-15.out +++ b/test/expected/partitionwise-15.out @@ -417,38 +417,38 @@ ORDER BY 1, 2; Runtime Exclusion: false -> Merge Append Sort Key: _hyper_1_1_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Sort - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Sort + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (PARTIAL avg(_hyper_1_1_chunk.temp)) + Sort Key: _hyper_1_1_chunk."time" + -> Partial HashAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device -> Index Scan Backward using _hyper_1_1_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device - -> Sort - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device + -> Sort + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, (PARTIAL avg(_hyper_1_2_chunk.temp)) + Sort Key: _hyper_1_2_chunk."time" + -> Partial HashAggregate + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device -> Index Scan Backward using _hyper_1_2_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Merge Append Sort Key: _hyper_1_3_chunk."time" - -> Partial GroupAggregate - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device - -> Sort - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device + -> Sort + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, (PARTIAL avg(_hyper_1_3_chunk.temp)) + Sort Key: _hyper_1_3_chunk."time" + -> Partial HashAggregate + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device -> Index Scan Backward using _hyper_1_3_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial GroupAggregate - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device - -> Sort - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp - Sort Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device + -> Sort + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, (PARTIAL avg(_hyper_1_4_chunk.temp)) + Sort Key: _hyper_1_4_chunk."time" + -> Partial HashAggregate + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device -> Index Scan Backward using _hyper_1_4_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_4_chunk Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp (47 rows) @@ -460,26 +460,36 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Partial aggregation pushdown is currently not supported for this query by -- the TSDB pushdown code since a projection is used in the path. @@ -489,26 +499,36 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Also test time_bucket SET timescaledb.enable_chunkwise_aggregation = 'off'; @@ -544,26 +564,36 @@ SELECT time_bucket('1 month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ Sort Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Test partitionwise joins, mostly to see that we do not break -- anything @@ -831,26 +861,28 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - -> GroupAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Incremental Sort - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - Presorted Key: (time_func(_hyper_3_7_chunk."time")) - -> Result - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - -> Merge Append - Sort Key: (time_func(_hyper_3_7_chunk."time")) - -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk - Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") - -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk - Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") -(17 rows) + -> Sort + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) + Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Finalize HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, PARTIAL avg(_hyper_3_7_chunk.temp) + Group Key: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk + Output: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + -> Partial HashAggregate + Output: (time_func(_hyper_3_8_chunk."time")), _hyper_3_8_chunk.device, PARTIAL avg(_hyper_3_8_chunk.temp) + Group Key: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk + Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp +(19 rows) -- Partial aggregation pushdown is currently not supported for this query by -- the TSDB pushdown code since a projection is used in the path. @@ -860,26 +892,28 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - -> GroupAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Incremental Sort - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), _hyper_3_7_chunk.temp - Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - Presorted Key: (time_func(_hyper_3_7_chunk."time")) - -> Result - Output: (time_func(_hyper_3_7_chunk."time")), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp - -> Merge Append - Sort Key: (time_func(_hyper_3_7_chunk."time")) - -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk - Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") - -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk - Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") -(17 rows) + -> Sort + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) + Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Finalize HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Append + -> Partial HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), PARTIAL avg(_hyper_3_7_chunk.temp) + Group Key: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device) + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk + Output: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp + -> Partial HashAggregate + Output: (time_func(_hyper_3_8_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device)), PARTIAL avg(_hyper_3_8_chunk.temp) + Group Key: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device) + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk + Output: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device), _hyper_3_8_chunk.temp +(19 rows) -- Test removal of redundant group key optimization in PG16 -- All lower versions include the redundant key on device column diff --git a/test/expected/query-15.out b/test/expected/query-15.out index 418da001ea4..7a54e89809f 100644 --- a/test/expected/query-15.out +++ b/test/expected/query-15.out @@ -150,28 +150,54 @@ SHOW timescaledb.enable_optimizations; (5 rows) :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_date GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) - -> Result - -> Merge Append - Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC - -> Index Scan using _hyper_4_6_chunk_time_plain_date on _hyper_4_6_chunk - -> Index Scan using _hyper_4_7_chunk_time_plain_date on _hyper_4_7_chunk - -> Index Scan using _hyper_4_8_chunk_time_plain_date on _hyper_4_8_chunk - -> Index Scan using _hyper_4_9_chunk_time_plain_date on _hyper_4_9_chunk - -> Index Scan using _hyper_4_10_chunk_time_plain_date on _hyper_4_10_chunk - -> Index Scan using _hyper_4_11_chunk_time_plain_date on _hyper_4_11_chunk - -> Index Scan using _hyper_4_12_chunk_time_plain_date on _hyper_4_12_chunk - -> Index Scan using _hyper_4_13_chunk_time_plain_date on _hyper_4_13_chunk - -> Index Scan using _hyper_4_14_chunk_time_plain_date on _hyper_4_14_chunk - -> Index Scan using _hyper_4_15_chunk_time_plain_date on _hyper_4_15_chunk - -> Index Scan using _hyper_4_16_chunk_time_plain_date on _hyper_4_16_chunk - -> Index Scan using _hyper_4_17_chunk_time_plain_date on _hyper_4_17_chunk - -> Index Scan using _hyper_4_18_chunk_time_plain_date on _hyper_4_18_chunk -(19 rows) + -> Sort + Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC + -> Finalize HashAggregate + Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) + -> Append + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_6_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_7_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_7_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_8_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_8_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_9_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_9_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_10_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_10_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_11_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_11_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_12_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_12_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_13_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_13_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_14_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_14_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_15_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_15_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_16_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_16_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_17_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_17_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_18_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_18_chunk +(45 rows) --the minute and second results should be diff :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2; diff --git a/test/expected/sql_query.out b/test/expected/sql_query.out index 4adff1be1f8..b8ed0a50b4d 100644 --- a/test/expected/sql_query.out +++ b/test/expected/sql_query.out @@ -259,50 +259,70 @@ EXPLAIN (verbose ON, costs off)SELECT "timeCustom" t, min(series_0) FROM PUBLIC. --The query should still use the index on timeCustom, even though the GROUP BY/ORDER BY is on the transformed time 't'. --However, current query plans show that it does not. EXPLAIN (verbose ON, costs off)SELECT "timeCustom"/10 t, min(series_0) FROM PUBLIC."two_Partitions" GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN --------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------ Limit Output: ((_hyper_1_1_chunk."timeCustom" / 10)), (min(_hyper_1_1_chunk.series_0)) -> Sort Output: ((_hyper_1_1_chunk."timeCustom" / 10)), (min(_hyper_1_1_chunk.series_0)) Sort Key: ((_hyper_1_1_chunk."timeCustom" / 10)) DESC NULLS LAST - -> HashAggregate + -> Finalize HashAggregate Output: ((_hyper_1_1_chunk."timeCustom" / 10)), min(_hyper_1_1_chunk.series_0) - Group Key: (_hyper_1_1_chunk."timeCustom" / 10) - -> Result - Output: (_hyper_1_1_chunk."timeCustom" / 10), _hyper_1_1_chunk.series_0 - -> Append + Group Key: ((_hyper_1_1_chunk."timeCustom" / 10)) + -> Append + -> Partial HashAggregate + Output: ((_hyper_1_1_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_1_chunk.series_0) + Group Key: (_hyper_1_1_chunk."timeCustom" / 10) -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."timeCustom", _hyper_1_1_chunk.series_0 + Output: (_hyper_1_1_chunk."timeCustom" / 10), _hyper_1_1_chunk.series_0 + -> Partial HashAggregate + Output: ((_hyper_1_2_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_2_chunk.series_0) + Group Key: (_hyper_1_2_chunk."timeCustom" / 10) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."timeCustom", _hyper_1_2_chunk.series_0 + Output: (_hyper_1_2_chunk."timeCustom" / 10), _hyper_1_2_chunk.series_0 + -> Partial HashAggregate + Output: ((_hyper_1_3_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_3_chunk.series_0) + Group Key: (_hyper_1_3_chunk."timeCustom" / 10) -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."timeCustom", _hyper_1_3_chunk.series_0 + Output: (_hyper_1_3_chunk."timeCustom" / 10), _hyper_1_3_chunk.series_0 + -> Partial HashAggregate + Output: ((_hyper_1_4_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_4_chunk.series_0) + Group Key: (_hyper_1_4_chunk."timeCustom" / 10) -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."timeCustom", _hyper_1_4_chunk.series_0 -(19 rows) + Output: (_hyper_1_4_chunk."timeCustom" / 10), _hyper_1_4_chunk.series_0 +(29 rows) EXPLAIN (verbose ON, costs off)SELECT "timeCustom"%10 t, min(series_0) FROM PUBLIC."two_Partitions" GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN --------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------- Limit Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), (min(_hyper_1_1_chunk.series_0)) -> Sort Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), (min(_hyper_1_1_chunk.series_0)) Sort Key: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)) DESC NULLS LAST - -> HashAggregate + -> Finalize HashAggregate Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), min(_hyper_1_1_chunk.series_0) - Group Key: (_hyper_1_1_chunk."timeCustom" % '10'::bigint) - -> Result - Output: (_hyper_1_1_chunk."timeCustom" % '10'::bigint), _hyper_1_1_chunk.series_0 - -> Append + Group Key: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)) + -> Append + -> Partial HashAggregate + Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_1_chunk.series_0) + Group Key: (_hyper_1_1_chunk."timeCustom" % '10'::bigint) -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."timeCustom", _hyper_1_1_chunk.series_0 + Output: (_hyper_1_1_chunk."timeCustom" % '10'::bigint), _hyper_1_1_chunk.series_0 + -> Partial HashAggregate + Output: ((_hyper_1_2_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_2_chunk.series_0) + Group Key: (_hyper_1_2_chunk."timeCustom" % '10'::bigint) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."timeCustom", _hyper_1_2_chunk.series_0 + Output: (_hyper_1_2_chunk."timeCustom" % '10'::bigint), _hyper_1_2_chunk.series_0 + -> Partial HashAggregate + Output: ((_hyper_1_3_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_3_chunk.series_0) + Group Key: (_hyper_1_3_chunk."timeCustom" % '10'::bigint) -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."timeCustom", _hyper_1_3_chunk.series_0 + Output: (_hyper_1_3_chunk."timeCustom" % '10'::bigint), _hyper_1_3_chunk.series_0 + -> Partial HashAggregate + Output: ((_hyper_1_4_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_4_chunk.series_0) + Group Key: (_hyper_1_4_chunk."timeCustom" % '10'::bigint) -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."timeCustom", _hyper_1_4_chunk.series_0 -(19 rows) + Output: (_hyper_1_4_chunk."timeCustom" % '10'::bigint), _hyper_1_4_chunk.series_0 +(29 rows) diff --git a/test/sql/partitionwise.sql.in b/test/sql/partitionwise.sql.in index 3f56154cc6e..6fc5854d8dd 100644 --- a/test/sql/partitionwise.sql.in +++ b/test/sql/partitionwise.sql.in @@ -152,8 +152,7 @@ FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) @@ -265,8 +264,7 @@ GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart diff --git a/tsl/test/expected/cagg_ddl-15.out b/tsl/test/expected/cagg_ddl-15.out index 0e4c513a179..66a4a81d623 100644 --- a/tsl/test/expected/cagg_ddl-15.out +++ b/tsl/test/expected/cagg_ddl-15.out @@ -1804,7 +1804,7 @@ View definition: _materialized_hypertable_45.cashflow2 FROM _timescaledb_internal._materialized_hypertable_45; -SELECT * FROM cashflows; +SELECT * FROM cashflows ORDER BY cashflows; bucket | amount | cashflow | cashflow2 ------------------------------+--------+----------+----------- Sun Dec 31 16:00:00 2017 PST | 1 | 10 | 11 @@ -1963,7 +1963,7 @@ View definition: FROM _timescaledb_internal._materialized_hypertable_53; -- Should return NO ROWS -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+--------+----- (0 rows) @@ -1991,13 +1991,13 @@ UNION ALL GROUP BY conditions.location, (time_bucket('@ 1 day'::interval, conditions."time")); -- Should return ROWS because now it is realtime -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+------------------------------+----- SFO | Sun Dec 31 16:00:00 2017 PST | 55 - SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Mon Jan 01 16:00:00 2018 PST | 65 por | Mon Jan 01 16:00:00 2018 PST | 100 + SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Wed Oct 31 17:00:00 2018 PDT | 65 NYC | Thu Nov 01 17:00:00 2018 PDT | 15 (6 rows) @@ -2018,13 +2018,13 @@ View definition: FROM _timescaledb_internal._materialized_hypertable_53; CALL refresh_continuous_aggregate('conditions_daily', NULL, NULL); -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+------------------------------+----- SFO | Sun Dec 31 16:00:00 2017 PST | 55 - SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Mon Jan 01 16:00:00 2018 PST | 65 por | Mon Jan 01 16:00:00 2018 PST | 100 + SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Wed Oct 31 17:00:00 2018 PDT | 65 NYC | Thu Nov 01 17:00:00 2018 PDT | 15 (6 rows) @@ -2081,13 +2081,13 @@ SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark (1 row) -- Should return ROWS because the watermark was reseted by the TRUNCATE -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; location | bucket | avg ----------+------------------------------+----- SFO | Sun Dec 31 16:00:00 2017 PST | 55 - SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Mon Jan 01 16:00:00 2018 PST | 65 por | Mon Jan 01 16:00:00 2018 PST | 100 + SFO | Mon Jan 01 16:00:00 2018 PST | 65 NYC | Wed Oct 31 17:00:00 2018 PDT | 65 NYC | Thu Nov 01 17:00:00 2018 PDT | 15 (6 rows) diff --git a/tsl/test/expected/cagg_on_cagg.out b/tsl/test/expected/cagg_on_cagg.out index 6be39d78011..ea1e9565b02 100644 --- a/tsl/test/expected/cagg_on_cagg.out +++ b/tsl/test/expected/cagg_on_cagg.out @@ -368,7 +368,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_4_4_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -376,17 +376,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -395,17 +395,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -415,7 +415,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_2_7_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -764,7 +764,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_8_11_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -772,17 +772,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -791,17 +791,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -811,7 +811,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_6_14_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -1486,7 +1486,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_16_18_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1494,17 +1494,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -1513,17 +1513,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1533,7 +1533,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_14_20_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -1878,7 +1878,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_20_24_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1886,17 +1886,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -1905,17 +1905,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1925,7 +1925,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_18_26_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -2700,7 +2700,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_29_30_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -2708,17 +2708,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -2727,17 +2727,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -2747,7 +2747,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_27_32_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -3091,7 +3091,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_33_36_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -3099,17 +3099,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature --------+------------- (0 rows) @@ -3118,17 +3118,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -3138,7 +3138,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_31_38_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- diff --git a/tsl/test/expected/cagg_on_cagg_joins.out b/tsl/test/expected/cagg_on_cagg_joins.out index 34bf41ecf4c..8e19848837d 100644 --- a/tsl/test/expected/cagg_on_cagg_joins.out +++ b/tsl/test/expected/cagg_on_cagg_joins.out @@ -379,7 +379,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_4_4_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -387,17 +387,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -406,17 +406,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -426,7 +426,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_2_7_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -786,7 +786,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_8_11_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_10" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -794,17 +794,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -813,17 +813,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_5" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------+-------------+----------- 1 | 10 | 1 - 2 | 2 | 2 | 5 | 2 + 2 | 2 | 5 | 20 | 3 10 | 2 | (5 rows) @@ -833,7 +833,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_6_14_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_1" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -1522,7 +1522,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_16_18_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1530,17 +1530,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -1549,17 +1549,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1569,7 +1569,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_14_20_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -1924,7 +1924,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_20_24_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -1932,17 +1932,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -1951,17 +1951,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id --------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 | 10 | 1 - Sat Jan 01 01:00:00 2022 | 2 | Sat Jan 01 01:00:00 2022 | 5 | 2 + Sat Jan 01 01:00:00 2022 | 2 | Sun Jan 02 01:00:00 2022 | 20 | 3 Mon Jan 03 01:00:00 2022 | 2 | (5 rows) @@ -1971,7 +1971,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_18_26_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- @@ -2761,7 +2761,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_29_30_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -2769,17 +2769,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -2788,17 +2788,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -2808,7 +2808,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_27_32_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- Default tests @@ -3163,7 +3163,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; psql:include/cagg_on_cagg_common.sql:173: NOTICE: drop cascades to table _timescaledb_internal._hyper_33_36_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3_weekly" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG @@ -3171,17 +3171,17 @@ psql:include/cagg_on_cagg_common.sql:176: ERROR: relation "conditions_summary_3 TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; bucket | temperature | device_id --------+-------------+----------- (0 rows) @@ -3190,17 +3190,17 @@ SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; psql:include/cagg_on_cagg_common.sql:190: ERROR: relation "conditions_summary_2_daily" does not exist at character 15 \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; bucket | temperature | device_id ------------------------------+-------------+----------- Sat Jan 01 00:00:00 2022 UTC | 10 | 1 - Sat Jan 01 01:00:00 2022 UTC | 2 | Sat Jan 01 01:00:00 2022 UTC | 5 | 2 + Sat Jan 01 01:00:00 2022 UTC | 2 | Sun Jan 02 01:00:00 2022 UTC | 20 | 3 Mon Jan 03 01:00:00 2022 UTC | 2 | (5 rows) @@ -3210,7 +3210,7 @@ DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; psql:include/cagg_on_cagg_common.sql:197: NOTICE: drop cascades to table _timescaledb_internal._hyper_31_38_chunk \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; psql:include/cagg_on_cagg_common.sql:200: ERROR: relation "conditions_summary_1_hourly" does not exist at character 15 \set ON_ERROR_STOP 1 -- diff --git a/tsl/test/expected/cagg_query.out b/tsl/test/expected/cagg_query.out index fce7a54d4e5..0cd74a2e79f 100644 --- a/tsl/test/expected/cagg_query.out +++ b/tsl/test/expected/cagg_query.out @@ -112,25 +112,35 @@ select * from mat_m1 order by sumh, sumt, minl, timec ; :EXPLAIN select * from regview order by timec desc; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (min(_hyper_1_1_chunk.location)), (sum(_hyper_1_1_chunk.temperature)), (sum(_hyper_1_1_chunk.humidity)) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) DESC - -> GroupAggregate + -> Finalize GroupAggregate Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), min(_hyper_1_1_chunk.location), sum(_hyper_1_1_chunk.temperature), sum(_hyper_1_1_chunk.humidity) Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) -> Sort - Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (PARTIAL min(_hyper_1_1_chunk.location)), (PARTIAL sum(_hyper_1_1_chunk.temperature)), (PARTIAL sum(_hyper_1_1_chunk.humidity)) Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) - -> Result - Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Append - -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.location, _hyper_1_1_chunk.timec, _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.location, _hyper_1_2_chunk.timec, _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity -(16 rows) + -> Append + -> Partial GroupAggregate + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), PARTIAL min(_hyper_1_1_chunk.location), PARTIAL sum(_hyper_1_1_chunk.temperature), PARTIAL sum(_hyper_1_1_chunk.humidity) + Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Sort + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + -> Partial GroupAggregate + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), PARTIAL min(_hyper_1_2_chunk.location), PARTIAL sum(_hyper_1_2_chunk.temperature), PARTIAL sum(_hyper_1_2_chunk.humidity) + Group Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Sort + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity + Sort Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity +(26 rows) -- PUSHDOWN cases -- -- all group by elts in order by , reorder group by elts to match @@ -446,19 +456,29 @@ select * from mat_m1, regview where mat_m1.timec > '2018-10-01' and mat_m1.timec -> Hash Join Output: _hyper_2_4_chunk.location, _hyper_2_4_chunk.timec, _hyper_2_4_chunk.minl, _hyper_2_4_chunk.sumt, _hyper_2_4_chunk.sumh, _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (min(_hyper_1_1_chunk.location)), (sum(_hyper_1_1_chunk.temperature)), (sum(_hyper_1_1_chunk.humidity)) Hash Cond: ((time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) = _hyper_2_4_chunk.timec) - -> GroupAggregate + -> Finalize GroupAggregate Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), min(_hyper_1_1_chunk.location), sum(_hyper_1_1_chunk.temperature), sum(_hyper_1_1_chunk.humidity) Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) -> Sort - Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), (PARTIAL min(_hyper_1_1_chunk.location)), (PARTIAL sum(_hyper_1_1_chunk.temperature)), (PARTIAL sum(_hyper_1_1_chunk.humidity)) Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) - -> Result - Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Append - -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.location, _hyper_1_1_chunk.timec, _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity - -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.location, _hyper_1_2_chunk.timec, _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity + -> Append + -> Partial GroupAggregate + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), PARTIAL min(_hyper_1_1_chunk.location), PARTIAL sum(_hyper_1_1_chunk.temperature), PARTIAL sum(_hyper_1_1_chunk.humidity) + Group Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Sort + Output: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + Sort Key: _hyper_1_1_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_1_chunk.timec), _hyper_1_1_chunk.temperature, _hyper_1_1_chunk.humidity + -> Partial GroupAggregate + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), PARTIAL min(_hyper_1_2_chunk.location), PARTIAL sum(_hyper_1_2_chunk.temperature), PARTIAL sum(_hyper_1_2_chunk.humidity) + Group Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Sort + Output: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity + Sort Key: _hyper_1_2_chunk.location, (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec)) + -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.location, time_bucket('@ 1 day'::interval, _hyper_1_2_chunk.timec), _hyper_1_2_chunk.temperature, _hyper_1_2_chunk.humidity -> Hash Output: _hyper_2_4_chunk.location, _hyper_2_4_chunk.timec, _hyper_2_4_chunk.minl, _hyper_2_4_chunk.sumt, _hyper_2_4_chunk.sumh -> Append @@ -477,7 +497,7 @@ select * from mat_m1, regview where mat_m1.timec > '2018-10-01' and mat_m1.timec Output: _hyper_1_2_chunk_1.location, _hyper_1_2_chunk_1.timec, _hyper_1_2_chunk_1.temperature, _hyper_1_2_chunk_1.humidity Index Cond: ((_hyper_1_2_chunk_1.timec >= 'Sat Nov 03 17:00:00 2018 PDT'::timestamp with time zone) AND (_hyper_1_2_chunk_1.timec > 'Mon Oct 01 00:00:00 2018 PDT'::timestamp with time zone)) Filter: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk_1.timec) > 'Mon Oct 01 00:00:00 2018 PDT'::timestamp with time zone) -(37 rows) +(47 rows) select l.locid, mat_m1.* from mat_m1 , location_tab l where timec > '2018-10-01' and l.locname = mat_m1.location order by timec desc; locid | location | timec | minl | sumt | sumh diff --git a/tsl/test/expected/cagg_union_view-15.out b/tsl/test/expected/cagg_union_view-15.out index 24a7a3eda40..7b769ad257b 100644 --- a/tsl/test/expected/cagg_union_view-15.out +++ b/tsl/test/expected/cagg_union_view-15.out @@ -354,22 +354,31 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- - HashAggregate (actual rows=4 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - Batches: 1 - -> Result (actual rows=4 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=4 loops=1) + Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) + -> Sort (actual rows=4 loops=1) + Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) + Sort Method: quicksort -> Append (actual rows=4 loops=1) - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(13 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(22 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -393,21 +402,26 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - Batches: 1 - -> Result (actual rows=2 loops=1) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) + -> Sort (actual rows=2 loops=1) + Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) + Sort Method: quicksort -> Append (actual rows=2 loops=1) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(12 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(17 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -577,32 +591,39 @@ ORDER by 1; -- plan output :PREFIX SELECT * FROM mat_m1 ORDER BY 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=3 loops=1) Sort Key: _hyper_9_15_chunk.time_bucket Sort Method: quicksort -> Append (actual rows=3 loops=1) -> Index Scan using _hyper_9_15_chunk__materialized_hypertable_9_time_bucket_idx on _hyper_9_15_chunk (actual rows=1 loops=1) Index Cond: (time_bucket < 25) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(5, _hyper_7_11_chunk.a)) Filter: ((sum(_hyper_7_11_chunk.c) > 50) AND ((avg(_hyper_7_11_chunk.b))::integer > 12)) - Batches: 1 Rows Removed by Filter: 1 - -> Result (actual rows=6 loops=1) - -> Append (actual rows=6 loops=1) - -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - Rows Removed by Filter: 2 -(23 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket(5, _hyper_7_11_chunk.a)) + Sort Method: quicksort + -> Append (actual rows=3 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_13_chunk.a) + -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_14_chunk.a) + -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + Rows Removed by Filter: 2 +(30 rows) -- Test caggs with different time types CREATE TABLE smallint_table (time smallint, value int); diff --git a/tsl/test/expected/cagg_watermark-15.out b/tsl/test/expected/cagg_watermark-15.out index 8800c7c5125..da9a5017370 100644 --- a/tsl/test/expected/cagg_watermark-15.out +++ b/tsl/test/expected/cagg_watermark-15.out @@ -467,16 +467,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -484,16 +489,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); :EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; @@ -502,18 +512,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -521,18 +539,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) -- Materialize CAgg and check for plan time chunk exclusion CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); @@ -1187,15 +1213,17 @@ CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 1 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 1 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_49_chunk."time"), _hyper_7_49_chunk.device + Batches: 1 -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(43 rows) +(45 rows) RESET timescaledb.enable_cagg_watermark_constify; -- Select with projection @@ -1304,12 +1332,14 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Append (actual rows=3 loops=1) @@ -1353,15 +1383,17 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Result (actual rows=0 loops=1) One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks_1."time"), chunks_1.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks_1."time")), chunks_1.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk_1."time"), _hyper_7_51_chunk_1.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(94 rows) +(98 rows) -- Aggregation query over CAgg should be constified :EXPLAIN_ANALYZE SELECT max(device) from chunks_1h; @@ -1576,31 +1608,39 @@ UNION ALL FROM small_integer_ht WHERE small_integer_ht."time" < COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) GROUP BY (time_bucket(5, small_integer_ht."time")); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=6 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht."time") - Batches: 1 - -> Result (actual rows=0 loops=1) + -> Finalize GroupAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht."time")) + -> Sort (actual rows=0 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht."time")) + Sort Method: quicksort -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) Chunks excluded during startup: 3 - -> HashAggregate (actual rows=6 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht_1."time") - Batches: 1 - -> Result (actual rows=26 loops=1) - -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=26 loops=1) + -> Finalize GroupAggregate (actual rows=6 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + -> Sort (actual rows=6 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=6 loops=1) Chunks excluded during startup: 0 - -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 6 -(22 rows) + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_61_chunk."time") + -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_62_chunk."time") + -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_63_chunk."time") + -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 6 +(30 rows) -- test with non constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1661,16 +1701,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(55 rows) +(57 rows) -- test with NULL constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1731,16 +1773,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(55 rows) +(57 rows) -- test with double COALESCE function (should be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max diff --git a/tsl/test/expected/continuous_aggs-15.out b/tsl/test/expected/continuous_aggs-15.out index 3a9e83e9463..decbc17e3cd 100644 --- a/tsl/test/expected/continuous_aggs-15.out +++ b/tsl/test/expected/continuous_aggs-15.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2047,15 +2047,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(18 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(23 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2068,8 +2073,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2082,15 +2087,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(20 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(25 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 48ef73df8ec..beb098d5741 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -9400,22 +9400,27 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; (10 rows) EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v0 FROM metrics GROUP BY bucket; - QUERY PLAN --------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Finalize HashAggregate Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather Workers Planned: 3 - -> Partial HashAggregate - Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") - -> Result - -> Parallel Append + -> Parallel Append + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") + -> Result -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") + -> Result -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk -> Parallel Seq Scan on compress_hyper_5_16_chunk - -> Parallel Seq Scan on _hyper_1_2_chunk -(13 rows) + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_2_chunk."time") + -> Parallel Seq Scan on _hyper_1_2_chunk +(18 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 87a9df6a150..5dea6de0a71 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -381,136 +381,226 @@ SELECT sum(segment_by_value) FROM testtable WHERE float_value > 0; SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.float_value Group Key: _hyper_1_1_chunk.float_value - -> Gather Merge + -> Gather Output: _hyper_1_1_chunk.float_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) Workers Planned: 2 - -> Sort - Output: _hyper_1_1_chunk.float_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Sort Key: _hyper_1_1_chunk.float_value + -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.float_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) Group Key: _hyper_1_1_chunk.float_value - -> Parallel Append + -> Result + Output: _hyper_1_1_chunk.float_value, _hyper_1_1_chunk.segment_by_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.float_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) + Group Key: _hyper_1_2_chunk.float_value + -> Result + Output: _hyper_1_2_chunk.float_value, _hyper_1_2_chunk.segment_by_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.float_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) + Group Key: _hyper_1_3_chunk.float_value + -> Result + Output: _hyper_1_3_chunk.float_value, _hyper_1_3_chunk.segment_by_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.float_value -(39 rows) + -> Partial HashAggregate + Output: _hyper_1_4_chunk.float_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.float_value, _hyper_1_4_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.float_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.float_value, _hyper_1_5_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.float_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.float_value, _hyper_1_6_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.float_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.float_value, _hyper_1_7_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.float_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.float_value, _hyper_1_8_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.float_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.float_value, _hyper_1_9_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.float_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.float_value, _hyper_1_10_chunk.segment_by_value +(69 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.int_value Group Key: _hyper_1_1_chunk.int_value - -> Gather Merge + -> Gather Output: _hyper_1_1_chunk.int_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) Workers Planned: 2 - -> Sort - Output: _hyper_1_1_chunk.int_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Sort Key: _hyper_1_1_chunk.int_value + -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.int_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) Group Key: _hyper_1_1_chunk.int_value - -> Parallel Append + -> Result + Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.int_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) + Group Key: _hyper_1_2_chunk.int_value + -> Result + Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.int_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) + Group Key: _hyper_1_3_chunk.int_value + -> Result + Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value -(39 rows) + -> Partial HashAggregate + Output: _hyper_1_4_chunk.int_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.int_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.int_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.int_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.int_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.int_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.int_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.int_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value +(69 rows) :EXPLAIN SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + Finalize HashAggregate Output: sum(_hyper_1_1_chunk.int_value), _hyper_1_1_chunk.segment_by_value Group Key: _hyper_1_1_chunk.segment_by_value - -> Gather Merge + -> Gather Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) Workers Planned: 2 - -> Sort - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) - Sort Key: _hyper_1_1_chunk.segment_by_value + -> Parallel Append -> Partial HashAggregate Output: _hyper_1_1_chunk.segment_by_value, PARTIAL sum(_hyper_1_1_chunk.int_value) Group Key: _hyper_1_1_chunk.segment_by_value - -> Parallel Append + -> Result + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.segment_by_value, PARTIAL sum(_hyper_1_2_chunk.int_value) + Group Key: _hyper_1_2_chunk.segment_by_value + -> Result + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.segment_by_value, PARTIAL sum(_hyper_1_3_chunk.int_value) + Group Key: _hyper_1_3_chunk.segment_by_value + -> Result + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value -(39 rows) + -> Partial HashAggregate + Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.int_value) + Group Key: _hyper_1_4_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.int_value) + Group Key: _hyper_1_5_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.int_value) + Group Key: _hyper_1_6_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.int_value) + Group Key: _hyper_1_7_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.int_value) + Group Key: _hyper_1_8_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.int_value) + Group Key: _hyper_1_9_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.int_value) + Group Key: _hyper_1_10_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value +(69 rows) -- Vectorization not possible due to two variables and grouping :EXPLAIN diff --git a/tsl/test/sql/cagg_ddl.sql.in b/tsl/test/sql/cagg_ddl.sql.in index 84d8ce6c835..ca2c6d61ba3 100644 --- a/tsl/test/sql/cagg_ddl.sql.in +++ b/tsl/test/sql/cagg_ddl.sql.in @@ -1163,7 +1163,7 @@ WHERE user_view_name = 'cashflows' \d+ "_timescaledb_internal".:"MAT_TABLE_NAME" \d+ 'cashflows' -SELECT * FROM cashflows; +SELECT * FROM cashflows ORDER BY cashflows; -- test cagg creation with named arguments in time_bucket -- note that positional arguments cannot follow named arguments @@ -1281,20 +1281,20 @@ WITH NO DATA; \d+ conditions_daily -- Should return NO ROWS -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; ALTER MATERIALIZED VIEW conditions_daily SET (timescaledb.materialized_only=false); \d+ conditions_daily -- Should return ROWS because now it is realtime -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; -- Should return ROWS because we refreshed it ALTER MATERIALIZED VIEW conditions_daily SET (timescaledb.materialized_only=true); \d+ conditions_daily CALL refresh_continuous_aggregate('conditions_daily', NULL, NULL); -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; -- Test TRUNCATE over a Realtime CAgg DROP MATERIALIZED VIEW conditions_daily; @@ -1332,7 +1332,7 @@ SELECT count(*) FROM show_chunks('conditions_daily'); SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:mat_hypertable_id)) AS watermak_after; -- Should return ROWS because the watermark was reseted by the TRUNCATE -SELECT * FROM conditions_daily ORDER BY bucket, avg; +SELECT * FROM conditions_daily ORDER BY bucket, location; -- check compression settings are cleaned up when deleting a cagg with compression CREATE TABLE cagg_cleanup(time timestamptz not null); diff --git a/tsl/test/sql/cagg_migrate_function.sql.in b/tsl/test/sql/cagg_migrate_function.sql.in index efc8353e19c..4356c80044b 100644 --- a/tsl/test/sql/cagg_migrate_function.sql.in +++ b/tsl/test/sql/cagg_migrate_function.sql.in @@ -203,7 +203,7 @@ SELECT time_bucket('1 week', time, origin=>'2000-01-01 00:00:00+01'), sensor, av ORDER BY 1, 2; -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week; +SELECT * FROM cagg_temp_ng_1week ORDER BY time, sensor; ---- @@ -244,7 +244,7 @@ SELECT timescaledb_experimental.time_bucket_ng('1 week', time, '2005-01-01 15:00 ORDER BY 1, 2; -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week_corgin; +SELECT * FROM cagg_temp_ng_1week_corgin ORDER BY time, sensor; ---- -- Check bucket conversion -- timestamp without custom origin diff --git a/tsl/test/sql/include/cagg_on_cagg_common.sql b/tsl/test/sql/include/cagg_on_cagg_common.sql index 8f0e73346cb..3c2132419d6 100644 --- a/tsl/test/sql/include/cagg_on_cagg_common.sql +++ b/tsl/test/sql/include/cagg_on_cagg_common.sql @@ -173,29 +173,29 @@ CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); DROP MATERIALIZED VIEW :CAGG_NAME_3TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_3TH_LEVEL ORDER BY bucket, device_id; \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs TRUNCATE :CAGG_NAME_2TH_LEVEL,:CAGG_NAME_1ST_LEVEL; CALL refresh_continuous_aggregate(:'CAGG_NAME_2TH_LEVEL', NULL, NULL); CALL refresh_continuous_aggregate(:'CAGG_NAME_1ST_LEVEL', NULL, NULL); -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; -- DROP the 2TH level CAGG don't affect others DROP MATERIALIZED VIEW :CAGG_NAME_2TH_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_2TH_LEVEL ORDER BY bucket, temperature; \set ON_ERROR_STOP 1 -- should work because dropping the top level CAGG -- don't affect the down level CAGGs -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; -- DROP the first CAGG should work DROP MATERIALIZED VIEW :CAGG_NAME_1ST_LEVEL; \set ON_ERROR_STOP 0 -- should error because it was dropped -SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket; +SELECT * FROM :CAGG_NAME_1ST_LEVEL ORDER BY bucket, device_id; \set ON_ERROR_STOP 1 From 4b0a1be893acc0daca039fc813e9994f8718749e Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:43:01 +0200 Subject: [PATCH 078/157] tmp debug -- cost based partial aggregation paths --- src/planner/partialize.c | 4 ++-- src/planner/planner.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index da6345593a1..2fffbb64ded 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -901,8 +901,8 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel fprintf(stderr, "will replan\n"); /* Prefer our paths */ - output_rel->pathlist = NIL; - output_rel->partial_pathlist = NIL; +// output_rel->pathlist = NIL; +// output_rel->partial_pathlist = NIL; /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top * of them. */ diff --git a/src/planner/planner.c b/src/planner/planner.c index f22537ebc8f..0860f1549af 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -1571,11 +1571,11 @@ timescaledb_create_upper_paths_hook(PlannerInfo *root, UpperRelationKind stage, if (parse->hasAggs) ts_preprocess_first_last_aggregates(root, root->processed_tlist); - if (ts_guc_enable_chunkwise_aggregation) - ts_pushdown_partial_agg(root, ht, input_rel, output_rel, extra); - if (!partials_found) ts_plan_add_hashagg(root, input_rel, output_rel); + + if (ts_guc_enable_chunkwise_aggregation) + ts_pushdown_partial_agg(root, ht, input_rel, output_rel, extra); } } From 59ec486fa9525b7a7efb8d6fff9a712d0dac7ea0 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:01:20 +0200 Subject: [PATCH 079/157] fix for custom agg paths --- src/planner/partialize.c | 4 +- src/planner/planner.c | 10 ++--- test/expected/agg_bookends.out | 35 ++++++++++----- test/expected/parallel-15.out | 68 ++++++++++++++++-------------- test/expected/partitionwise-15.out | 6 +-- test/expected/query-15.out | 56 ++++++++++++++---------- 6 files changed, 104 insertions(+), 75 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index 2fffbb64ded..da6345593a1 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -901,8 +901,8 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel fprintf(stderr, "will replan\n"); /* Prefer our paths */ -// output_rel->pathlist = NIL; -// output_rel->partial_pathlist = NIL; + output_rel->pathlist = NIL; + output_rel->partial_pathlist = NIL; /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top * of them. */ diff --git a/src/planner/planner.c b/src/planner/planner.c index 0860f1549af..5fa6d4fd13c 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -1566,16 +1566,16 @@ timescaledb_create_upper_paths_hook(PlannerInfo *root, UpperRelationKind stage, if (!involves_hypertable(root, input_rel)) return; - if (stage == UPPERREL_GROUP_AGG && output_rel != NULL) + if (parse->hasAggs && stage == UPPERREL_GROUP_AGG && output_rel != NULL && !partials_found) { - if (parse->hasAggs) - ts_preprocess_first_last_aggregates(root, root->processed_tlist); + ts_preprocess_first_last_aggregates(root, root->processed_tlist); - if (!partials_found) - ts_plan_add_hashagg(root, input_rel, output_rel); + ts_plan_add_hashagg(root, input_rel, output_rel); if (ts_guc_enable_chunkwise_aggregation) + { ts_pushdown_partial_agg(root, ht, input_rel, output_rel, extra); + } } } diff --git a/test/expected/agg_bookends.out b/test/expected/agg_bookends.out index e1927d3c926..67681bf3711 100644 --- a/test/expected/agg_bookends.out +++ b/test/expected/agg_bookends.out @@ -450,21 +450,36 @@ INSERT INTO btest_numeric VALUES('2020-01-20T09:00:43', 30.5); -- can't do index scan when using group by :PREFIX SELECT last(temp, time) FROM btest GROUP BY gp ORDER BY gp; - QUERY PLAN ------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------ Sort (actual rows=2 loops=1) Sort Key: _hyper_1_1_chunk.gp Sort Method: quicksort - -> HashAggregate (actual rows=2 loops=1) + -> Finalize HashAggregate (actual rows=2 loops=1) Group Key: _hyper_1_1_chunk.gp Batches: 1 - -> Append (actual rows=11 loops=1) - -> Seq Scan on _hyper_1_1_chunk (actual rows=6 loops=1) - -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) - -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_4_chunk (actual rows=1 loops=1) - -> Seq Scan on _hyper_1_5_chunk (actual rows=1 loops=1) -(12 rows) + -> Append (actual rows=6 loops=1) + -> Partial HashAggregate (actual rows=2 loops=1) + Group Key: _hyper_1_1_chunk.gp + Batches: 1 + -> Seq Scan on _hyper_1_1_chunk (actual rows=6 loops=1) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: _hyper_1_2_chunk.gp + Batches: 1 + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: _hyper_1_3_chunk.gp + Batches: 1 + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: _hyper_1_4_chunk.gp + Batches: 1 + -> Seq Scan on _hyper_1_4_chunk (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: _hyper_1_5_chunk.gp + Batches: 1 + -> Seq Scan on _hyper_1_5_chunk (actual rows=1 loops=1) +(27 rows) -- do index scan when agg function is used in CTE subquery :PREFIX WITH last_temp AS (SELECT last(temp, time) FROM btest) SELECT * from last_temp; diff --git a/test/expected/parallel-15.out b/test/expected/parallel-15.out index 177ed0cb02c..2b686d6aa2f 100644 --- a/test/expected/parallel-15.out +++ b/test/expected/parallel-15.out @@ -72,21 +72,23 @@ FROM "test" GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------- - Gather - Workers Planned: 1 - Single Copy: true - -> Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Result - -> Append - -> Seq Scan on _hyper_1_1_chunk - -> Seq Scan on _hyper_1_2_chunk -(12 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------- + Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Parallel Seq Scan on _hyper_1_1_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) + -> Parallel Seq Scan on _hyper_1_2_chunk +(14 rows) -- test single copy parallel plan with parallel chunk append :PREFIX SELECT time_bucket('1 second', ts) sec, last(i, j) @@ -95,28 +97,30 @@ WHERE length(version()) > 0 GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------- - Gather - Workers Planned: 1 - Single Copy: true - -> Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, test.ts) + QUERY PLAN +-------------------------------------------------------------------------------------------------------- + Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> Gather + Workers Planned: 2 -> Result - -> Result - One-Time Filter: (length(version()) > 0) - -> Custom Scan (ChunkAppend) on test - Chunks excluded during startup: 0 + One-Time Filter: (length(version()) > 0) + -> Parallel Custom Scan (ChunkAppend) on test + Chunks excluded during startup: 0 + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) -> Result One-Time Filter: (length(version()) > 0) - -> Seq Scan on _hyper_1_1_chunk + -> Parallel Seq Scan on _hyper_1_1_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) -> Result One-Time Filter: (length(version()) > 0) - -> Seq Scan on _hyper_1_2_chunk -(19 rows) + -> Parallel Seq Scan on _hyper_1_2_chunk +(21 rows) SELECT time_bucket('1 second', ts) sec, last(i, j) FROM "test" diff --git a/test/expected/partitionwise-15.out b/test/expected/partitionwise-15.out index 9c3b291b802..ef05828eb26 100644 --- a/test/expected/partitionwise-15.out +++ b/test/expected/partitionwise-15.out @@ -491,8 +491,7 @@ ORDER BY 1, 2; Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp (27 rows) --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) @@ -884,8 +883,7 @@ LIMIT 10; Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp (19 rows) --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart diff --git a/test/expected/query-15.out b/test/expected/query-15.out index 7a54e89809f..8447ecba3bd 100644 --- a/test/expected/query-15.out +++ b/test/expected/query-15.out @@ -360,33 +360,45 @@ BEGIN; :PREFIX SELECT time_bucket(10, time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (time_bucket(10, hyper_1_int."time")) - -> Result - -> Custom Scan (ChunkAppend) on hyper_1_int - Order: time_bucket(10, hyper_1_int."time") DESC - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(9 rows) + -> Sort + Sort Key: (time_bucket(10, _hyper_3_5_chunk."time")) DESC + -> Finalize HashAggregate + Group Key: (time_bucket(10, _hyper_3_5_chunk."time")) + -> Append + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_5_chunk."time") + -> Seq Scan on _hyper_3_5_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_4_chunk."time") + -> Seq Scan on _hyper_3_4_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_3_chunk."time") + -> Seq Scan on _hyper_3_3_chunk +(15 rows) :PREFIX SELECT time_bucket(10, time, 2) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (time_bucket(10, hyper_1_int."time", 2)) - -> Result - -> Custom Scan (ChunkAppend) on hyper_1_int - Order: time_bucket(10, hyper_1_int."time", 2) DESC - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(9 rows) + -> Sort + Sort Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) DESC + -> Finalize HashAggregate + Group Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) + -> Append + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_5_chunk."time", 2) + -> Seq Scan on _hyper_3_5_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_4_chunk."time", 2) + -> Seq Scan on _hyper_3_4_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_3_chunk."time", 2) + -> Seq Scan on _hyper_3_3_chunk +(15 rows) ROLLBACK; -- sort order optimization should not be applied to non-hypertables From bab2db4336de9b70d6d5ae0034a47152338310f9 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:02:31 +0200 Subject: [PATCH 080/157] remove debug --- src/planner/partialize.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/planner/partialize.c b/src/planner/partialize.c index da6345593a1..2ef58249f1d 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -608,9 +608,6 @@ generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_pat bool can_hash, double d_num_groups, GroupPathExtraData *extra_data) { - fprintf(stderr, "try generate partial for:\n"); - my_print(cheapest_partial_path); - /* Get subpaths */ List *subpaths = get_subpaths_from_append_path(cheapest_partial_path, false); @@ -898,8 +895,6 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel if (partially_grouped_rel->pathlist == NIL) return; - fprintf(stderr, "will replan\n"); - /* Prefer our paths */ output_rel->pathlist = NIL; output_rel->partial_pathlist = NIL; @@ -959,7 +954,6 @@ ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel d_num_groups)); } } - fprintf(stderr, "replanning done\n"); } /* From 7b0a442bb7866dcdcd1ca1ca055fd4d5e7a6232d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:11:24 +0200 Subject: [PATCH 081/157] fix the tests --- src/planner/planner.c | 10 +- .../expected/cagg_migrate_function-15.out | 4 +- .../transparent_decompression_queries.out | 141 +++++----- .../cagg_watermark_concurrent_update.out | 256 ++++++++++-------- tsl/test/sql/cagg_migrate_function.sql.in | 4 +- 5 files changed, 225 insertions(+), 190 deletions(-) diff --git a/src/planner/planner.c b/src/planner/planner.c index 5fa6d4fd13c..0860f1549af 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -1566,16 +1566,16 @@ timescaledb_create_upper_paths_hook(PlannerInfo *root, UpperRelationKind stage, if (!involves_hypertable(root, input_rel)) return; - if (parse->hasAggs && stage == UPPERREL_GROUP_AGG && output_rel != NULL && !partials_found) + if (stage == UPPERREL_GROUP_AGG && output_rel != NULL) { - ts_preprocess_first_last_aggregates(root, root->processed_tlist); + if (parse->hasAggs) + ts_preprocess_first_last_aggregates(root, root->processed_tlist); - ts_plan_add_hashagg(root, input_rel, output_rel); + if (!partials_found) + ts_plan_add_hashagg(root, input_rel, output_rel); if (ts_guc_enable_chunkwise_aggregation) - { ts_pushdown_partial_agg(root, ht, input_rel, output_rel, extra); - } } } diff --git a/tsl/test/expected/cagg_migrate_function-15.out b/tsl/test/expected/cagg_migrate_function-15.out index 1533c8ac223..e9f4a249a3a 100644 --- a/tsl/test/expected/cagg_migrate_function-15.out +++ b/tsl/test/expected/cagg_migrate_function-15.out @@ -944,7 +944,7 @@ SELECT time_bucket('1 week', time, origin=>'2000-01-01 00:00:00'), sensor, avg(v (4 rows) -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week_timestamp; +SELECT * FROM cagg_temp_ng_1week_timestamp ORDER BY time, sensor; time | sensor | avg --------------------------+--------+----- Sat Dec 26 00:00:00 2009 | 1 | 101 @@ -1027,7 +1027,7 @@ SELECT time_bucket('1 week', time, origin=>'2000-01-01 01:00:00+00'), sensor, av (4 rows) -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week_date; +SELECT * FROM cagg_temp_ng_1week_date ORDER BY time, sensor; time | sensor | avg ------------+--------+----- 12-26-2009 | 1 | 101 diff --git a/tsl/test/expected/transparent_decompression_queries.out b/tsl/test/expected/transparent_decompression_queries.out index a05ecc89770..692be4f00ff 100644 --- a/tsl/test/expected/transparent_decompression_queries.out +++ b/tsl/test/expected/transparent_decompression_queries.out @@ -82,39 +82,50 @@ EXPLAIN (analyze,costs off,timing off,summary off) SELECT FROM merge_sort WHERE time < now() GROUP BY 2, 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- - GroupAggregate (actual rows=1 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=1 loops=1) Group Key: merge_sort.device_id, merge_sort.measure_id - -> Custom Scan (ConstraintAwareAppend) (actual rows=745 loops=1) - Hypertable: merge_sort - Chunks excluded during startup: 0 - -> Merge Append (actual rows=745 loops=1) - 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) - Vectorized Filter: ("time" < "timestamp"(now())) - -> 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 - -> Seq Scan on _hyper_3_6_chunk (actual rows=168 loops=1) - Filter: ("time" < now()) - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) - Filter: ("time" < now()) - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) - Filter: ("time" < now()) - -> Sort (actual rows=121 loops=1) - Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) - Filter: ("time" < now()) -(30 rows) + -> Sort (actual rows=5 loops=1) + Sort Key: merge_sort.device_id, merge_sort.measure_id + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on merge_sort (actual rows=5 loops=1) + Chunks excluded during startup: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_5_chunk.device_id, _hyper_3_5_chunk.measure_id + -> Result (actual rows=120 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_3_5_chunk (actual rows=120 loops=1) + Vectorized Filter: ("time" < "timestamp"(now())) + -> 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_6_chunk (actual rows=168 loops=1) + Filter: ("time" < now()) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) + Filter: ("time" < now()) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) + Filter: ("time" < now()) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id + -> Sort (actual rows=121 loops=1) + Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) + Filter: ("time" < now()) +(41 rows) -- this should exclude the decompressed chunk EXPLAIN (analyze,costs off,timing off,summary off) SELECT @@ -125,36 +136,44 @@ EXPLAIN (analyze,costs off,timing off,summary off) SELECT FROM merge_sort WHERE time > '2000-01-10'::text::timestamp GROUP BY 2, 3; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- - GroupAggregate (actual rows=1 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=1 loops=1) Group Key: merge_sort.device_id, merge_sort.measure_id - -> Custom Scan (ConstraintAwareAppend) (actual rows=528 loops=1) - Hypertable: merge_sort - Chunks excluded during startup: 1 - -> Merge Append (actual rows=528 loops=1) - Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id - -> Sort (actual rows=71 loops=1) - Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id - Sort Method: quicksort - -> Index Scan using _hyper_3_6_chunk_merge_sort_time_idx on _hyper_3_6_chunk (actual rows=71 loops=1) - Index Cond: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) - Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) - Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) - -> Sort (actual rows=121 loops=1) - Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) - Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) -(27 rows) + -> Sort (actual rows=4 loops=1) + Sort Key: merge_sort.device_id, merge_sort.measure_id + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on merge_sort (actual rows=4 loops=1) + Chunks excluded during startup: 1 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id + -> Sort (actual rows=71 loops=1) + Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id + Sort Method: quicksort + -> Index Scan using _hyper_3_6_chunk_merge_sort_time_idx on _hyper_3_6_chunk (actual rows=71 loops=1) + Index Cond: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) + Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) + Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id + -> Sort (actual rows=121 loops=1) + Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) + Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) +(35 rows) RESET enable_hashagg; -- test if volatile function quals are applied to compressed chunks diff --git a/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out b/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out index bd6634c4dd5..310255f3492 100644 --- a/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out +++ b/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out @@ -18,21 +18,25 @@ debug_waitpoint_enable step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(12 rows) +QUERY PLAN +--------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(16 rows) step s1_run_update: CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); @@ -40,21 +44,25 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(12 rows) +QUERY PLAN +--------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(16 rows) step s3_release_invalidation: SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); @@ -68,43 +76,43 @@ step s1_run_update: <... completed> step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Sort - Sort Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Result - One-Time Filter: false +QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _materialized_hypertable_X.time_bucket + -> Custom Scan (ChunkAppend) on _materialized_hypertable_X + Order: _materialized_hypertable_X.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + -> GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, "time")) + -> Sort + Sort Key: (time_bucket('@ 4 hours'::interval, "time")) + -> Result + One-Time Filter: false (14 rows) step s1_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Sort - Sort Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Result - One-Time Filter: false +QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _materialized_hypertable_X.time_bucket + -> Custom Scan (ChunkAppend) on _materialized_hypertable_X + Order: _materialized_hypertable_X.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + -> GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, "time")) + -> Sort + Sort Key: (time_bucket('@ 4 hours'::interval, "time")) + -> Result + One-Time Filter: false (14 rows) @@ -120,21 +128,25 @@ debug_waitpoint_enable step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(12 rows) +QUERY PLAN +--------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(16 rows) step s1_run_update: CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); @@ -142,21 +154,25 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(12 rows) +QUERY PLAN +--------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(16 rows) step s3_release_invalidation: SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); @@ -184,21 +200,21 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) - -> Result +QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _materialized_hypertable_X.time_bucket + -> Custom Scan (ChunkAppend) on _materialized_hypertable_X + Order: _materialized_hypertable_X.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + -> GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Result -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) + Index Cond: ("time" >= 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) (13 rows) step s3_release_invalidation: @@ -213,20 +229,20 @@ step s1_run_update: <... completed> step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) - -> Result +QUERY PLAN +--------------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _materialized_hypertable_X.time_bucket + -> Custom Scan (ChunkAppend) on _materialized_hypertable_X + Order: _materialized_hypertable_X.time_bucket + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) + -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk + Index Cond: (time_bucket < 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) + -> GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Result -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) + Index Cond: ("time" >= 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) (13 rows) diff --git a/tsl/test/sql/cagg_migrate_function.sql.in b/tsl/test/sql/cagg_migrate_function.sql.in index 4356c80044b..3401ec9b674 100644 --- a/tsl/test/sql/cagg_migrate_function.sql.in +++ b/tsl/test/sql/cagg_migrate_function.sql.in @@ -295,7 +295,7 @@ SELECT time_bucket('1 week', time, origin=>'2000-01-01 00:00:00'), sensor, avg(v ORDER BY 1, 2; -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week_timestamp; +SELECT * FROM cagg_temp_ng_1week_timestamp ORDER BY time, sensor; ---- -- Check bucket conversion -- date without custom origin @@ -346,7 +346,7 @@ SELECT time_bucket('1 week', time, origin=>'2000-01-01 01:00:00+00'), sensor, av ORDER BY 1, 2; -- Even the CAgg now uses time_bucket, we should see buckets of the same alignment -SELECT * FROM cagg_temp_ng_1week_date; +SELECT * FROM cagg_temp_ng_1week_date ORDER BY time, sensor; -- Ensure we error out when the CAgg does not use a deprecated function \set ON_ERROR_STOP 0 From e78503298e81cda02d0ba01c0c1c1298253809b6 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:12:40 +0200 Subject: [PATCH 082/157] stabilize the telemetry_stats --- tsl/test/expected/telemetry_stats.out | 43 +++++++++++++++++---------- tsl/test/sql/telemetry_stats.sql | 15 ++++++++-- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/tsl/test/expected/telemetry_stats.out b/tsl/test/expected/telemetry_stats.out index d5160052fb7..60f74ef8992 100644 --- a/tsl/test/expected/telemetry_stats.out +++ b/tsl/test/expected/telemetry_stats.out @@ -161,8 +161,13 @@ SELECT * FROM normal; INSERT INTO part SELECT * FROM normal; CALL refresh_continuous_aggregate('contagg', NULL, NULL); +-- Reindex to avoid the dependency on the way the index is built (e.g. the caggs +-- might get their rows inserted in different order during the refresh based on +-- the underlying aggregation plan, and the index will be built differently, +-- which can influence its size). +REINDEX DATABASE :TEST_DBNAME; -- ANALYZE to get updated reltuples stats -ANALYZE normal, hyper, part; +VACUUM ANALYZE; SELECT count(c) FROM show_chunks('hyper') c; count ------- @@ -185,14 +190,14 @@ SELECT jsonb_pretty(rels) AS relations FROM relations; "num_relations": 2 + }, + "tables": { + - "heap_size": 65536, + + "heap_size": 73728, + "toast_size": 8192, + "indexes_size": 0, + "num_relations": 2, + "num_reltuples": 697 + }, + "hypertables": { + - "heap_size": 163840, + + "heap_size": 475136, + "toast_size": 0, + "compression": { + "compressed_heap_size": 0, + @@ -207,19 +212,19 @@ SELECT jsonb_pretty(rels) AS relations FROM relations; "num_compressed_hypertables": 0, + "compressed_row_count_frozen_immediately": 0+ }, + - "indexes_size": 286720, + + "indexes_size": 270336, + "num_children": 11, + "num_relations": 2, + - "num_reltuples": 697 + + "num_reltuples": 1394 + }, + "materialized_views": { + "toast_size": 8192, + "indexes_size": 0, + "num_relations": 1, + - "num_reltuples": 0 + + "num_reltuples": 1 + }, + "partitioned_tables": { + - "heap_size": 98304, + + "heap_size": 180224, + "toast_size": 0, + "indexes_size": 0, + "num_children": 6, + @@ -260,7 +265,7 @@ SELECT (SELECT count(*) FROM normal) num_inserted_rows, (SELECT rels -> 'partitioned_tables' -> 'num_reltuples' FROM relations) part_reltuples; num_inserted_rows | normal_reltuples | hyper_reltuples | part_reltuples -------------------+------------------+-----------------+---------------- - 697 | 697 | 697 | 697 + 697 | 697 | 1394 | 697 (1 row) -- Add compression @@ -290,7 +295,13 @@ FROM show_chunks('contagg') c ORDER BY c LIMIT 1; -- Turn of real-time aggregation ALTER MATERIALIZED VIEW contagg SET (timescaledb.materialized_only = true); -ANALYZE normal, hyper, part; +-- Reindex to avoid the dependency on the way the index is built (e.g. the caggs +-- might get their rows inserted in different order during the refresh based on +-- the underlying aggregation plan, and the index will be built differently, +-- which can influence its size). +REINDEX DATABASE :TEST_DBNAME; +-- ANALYZE to get updated reltuples stats +VACUUM ANALYZE; REFRESH MATERIALIZED VIEW telemetry_report; SELECT jsonb_pretty(rels) AS relations FROM relations; relations @@ -300,41 +311,41 @@ SELECT jsonb_pretty(rels) AS relations FROM relations; "num_relations": 2 + }, + "tables": { + - "heap_size": 65536, + + "heap_size": 73728, + "toast_size": 8192, + "indexes_size": 0, + "num_relations": 2, + "num_reltuples": 697 + }, + "hypertables": { + - "heap_size": 196608, + + "heap_size": 368640, + "toast_size": 40960, + "compression": { + "compressed_heap_size": 114688, + "compressed_row_count": 14, + "compressed_toast_size": 40960, + "num_compressed_chunks": 5, + - "uncompressed_heap_size": 81920, + + "uncompressed_heap_size": 221184, + "uncompressed_row_count": 736, + "compressed_indexes_size": 16384, + "uncompressed_toast_size": 0, + - "uncompressed_indexes_size": 147456, + + "uncompressed_indexes_size": 131072, + "num_compressed_hypertables": 2, + "compressed_row_count_frozen_immediately": 14+ }, + "indexes_size": 204800, + "num_children": 11, + "num_relations": 2, + - "num_reltuples": 413 + + "num_reltuples": 658 + }, + "materialized_views": { + "toast_size": 8192, + "indexes_size": 0, + "num_relations": 1, + - "num_reltuples": 0 + + "num_reltuples": 1 + }, + "partitioned_tables": { + - "heap_size": 98304, + + "heap_size": 180224, + "toast_size": 0, + "indexes_size": 0, + "num_children": 6, + diff --git a/tsl/test/sql/telemetry_stats.sql b/tsl/test/sql/telemetry_stats.sql index b0cc7583397..d227ebaecd5 100644 --- a/tsl/test/sql/telemetry_stats.sql +++ b/tsl/test/sql/telemetry_stats.sql @@ -77,8 +77,13 @@ SELECT * FROM normal; CALL refresh_continuous_aggregate('contagg', NULL, NULL); +-- Reindex to avoid the dependency on the way the index is built (e.g. the caggs +-- might get their rows inserted in different order during the refresh based on +-- the underlying aggregation plan, and the index will be built differently, +-- which can influence its size). +REINDEX DATABASE :TEST_DBNAME; -- ANALYZE to get updated reltuples stats -ANALYZE normal, hyper, part; +VACUUM ANALYZE; SELECT count(c) FROM show_chunks('hyper') c; SELECT count(c) FROM show_chunks('contagg') c; @@ -105,7 +110,13 @@ FROM show_chunks('contagg') c ORDER BY c LIMIT 1; -- Turn of real-time aggregation ALTER MATERIALIZED VIEW contagg SET (timescaledb.materialized_only = true); -ANALYZE normal, hyper, part; +-- Reindex to avoid the dependency on the way the index is built (e.g. the caggs +-- might get their rows inserted in different order during the refresh based on +-- the underlying aggregation plan, and the index will be built differently, +-- which can influence its size). +REINDEX DATABASE :TEST_DBNAME; +-- ANALYZE to get updated reltuples stats +VACUUM ANALYZE; REFRESH MATERIALIZED VIEW telemetry_report; SELECT jsonb_pretty(rels) AS relations FROM relations; From 55fedd26ea492e83b20102d39cc39bab6ef43785 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:37:19 +0200 Subject: [PATCH 083/157] partitionwise test --- test/expected/partitionwise-15.out | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/expected/partitionwise-15.out b/test/expected/partitionwise-15.out index ef05828eb26..602694003bb 100644 --- a/test/expected/partitionwise-15.out +++ b/test/expected/partitionwise-15.out @@ -417,38 +417,38 @@ ORDER BY 1, 2; Runtime Exclusion: false -> Merge Append Sort Key: _hyper_1_1_chunk."time" - -> Sort - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, (PARTIAL avg(_hyper_1_1_chunk.temp)) - Sort Key: _hyper_1_1_chunk."time" - -> Partial HashAggregate - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Partial GroupAggregate + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Sort + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device -> Index Scan Backward using _hyper_1_1_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Sort - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, (PARTIAL avg(_hyper_1_2_chunk.temp)) - Sort Key: _hyper_1_2_chunk."time" - -> Partial HashAggregate - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device + -> Partial GroupAggregate + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device + -> Sort + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device -> Index Scan Backward using _hyper_1_2_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Merge Append Sort Key: _hyper_1_3_chunk."time" - -> Sort - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, (PARTIAL avg(_hyper_1_3_chunk.temp)) - Sort Key: _hyper_1_3_chunk."time" - -> Partial HashAggregate - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device + -> Partial GroupAggregate + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device + -> Sort + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device -> Index Scan Backward using _hyper_1_3_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Sort - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, (PARTIAL avg(_hyper_1_4_chunk.temp)) - Sort Key: _hyper_1_4_chunk."time" - -> Partial HashAggregate - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device + -> Partial GroupAggregate + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device + -> Sort + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp + Sort Key: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device -> Index Scan Backward using _hyper_1_4_chunk_hyper_time_idx on _timescaledb_internal._hyper_1_4_chunk Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp (47 rows) From b23a737d714a3cbc7e1ab65081b0b458bfa54aaf Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:38:00 +0200 Subject: [PATCH 084/157] delete old alternative ref --- .../cagg_watermark_concurrent_update_1.out | 236 ------------------ 1 file changed, 236 deletions(-) delete mode 100644 tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out diff --git a/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out b/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out deleted file mode 100644 index 158ebd43d1c..00000000000 --- a/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out +++ /dev/null @@ -1,236 +0,0 @@ -Parsed test spec with 3 sessions - -starting permutation: s1_prepare s2_prepare s3_lock_invalidation s2_select s1_run_update s2_select s3_release_invalidation s2_select s1_select -step s1_prepare: - PREPARE pstmt AS SELECT * FROM cagg; - -step s2_prepare: - PREPARE pstmt AS SELECT * FROM cagg; - -step s3_lock_invalidation: - SELECT debug_waitpoint_enable('cagg_watermark_update_internal_before_refresh'); - -debug_waitpoint_enable ----------------------- - -(1 row) - -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Result - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(13 rows) - -step s1_run_update: - CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); - -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Result - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(13 rows) - -step s3_release_invalidation: - SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); - -debug_waitpoint_release ------------------------ - -(1 row) - -step s1_run_update: <... completed> -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Sort - Sort Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Result - One-Time Filter: false -(14 rows) - -step s1_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Sort - Sort Key: (time_bucket('@ 4 hours'::interval, "time")) - -> Result - One-Time Filter: false -(14 rows) - - -starting permutation: s3_lock_invalidation s2_select s1_run_update s2_select s3_release_invalidation s3_lock_invalidation s1_insert_more_data s1_run_update s2_select s3_release_invalidation s2_select -step s3_lock_invalidation: - SELECT debug_waitpoint_enable('cagg_watermark_update_internal_before_refresh'); - -debug_waitpoint_enable ----------------------- - -(1 row) - -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Result - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(13 rows) - -step s1_run_update: - CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); - -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Result - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(13 rows) - -step s3_release_invalidation: - SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); - -debug_waitpoint_release ------------------------ - -(1 row) - -step s1_run_update: <... completed> -step s3_lock_invalidation: - SELECT debug_waitpoint_enable('cagg_watermark_update_internal_before_refresh'); - -debug_waitpoint_enable ----------------------- - -(1 row) - -step s1_insert_more_data: - INSERT INTO temperature VALUES('2020-01-02 23:59:59+0', 22); - -step s1_run_update: - CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); - -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) - -> Result - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Wed Jan 01 16:00:00 2020 PST'::timestamp with time zone) -(13 rows) - -step s3_release_invalidation: - SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); - -debug_waitpoint_release ------------------------ - -(1 row) - -step s1_run_update: <... completed> -step s2_select: - EXPLAIN (COSTS OFF) EXECUTE pstmt; - -QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _materialized_hypertable_X.time_bucket - -> Custom Scan (ChunkAppend) on _materialized_hypertable_X - Order: _materialized_hypertable_X.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_i on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) - -> Result - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Thu Jan 02 16:00:00 2020 PST'::timestamp with time zone) -(13 rows) - From 63c7ab484ea6a1878e1daf69466d75eefdbf0e82 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Sat, 22 Jun 2024 17:33:46 +0200 Subject: [PATCH 085/157] add vacuum analyze to watermark update test --- .../cagg_watermark_concurrent_update.out | 164 ++++++++++-------- .../cagg_watermark_concurrent_update.spec | 5 + 2 files changed, 93 insertions(+), 76 deletions(-) diff --git a/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out b/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out index 310255f3492..5c5a10bdc45 100644 --- a/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out +++ b/tsl/test/isolation/expected/cagg_watermark_concurrent_update.out @@ -18,25 +18,28 @@ debug_waitpoint_enable step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ---------------------------------------------------------------------------------------------------------------- -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Finalize GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(16 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Sort + Sort Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Append + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Seq Scan on _hyper_X_X_chunk + Filter: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(19 rows) step s1_run_update: CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); @@ -44,25 +47,28 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ---------------------------------------------------------------------------------------------------------------- -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Finalize GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(16 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Sort + Sort Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Append + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Seq Scan on _hyper_X_X_chunk + Filter: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(19 rows) step s3_release_invalidation: SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); @@ -128,25 +134,28 @@ debug_waitpoint_enable step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ---------------------------------------------------------------------------------------------------------------- -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Finalize GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(16 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Sort + Sort Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Append + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Seq Scan on _hyper_X_X_chunk + Filter: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(19 rows) step s1_run_update: CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); @@ -154,25 +163,28 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ---------------------------------------------------------------------------------------------------------------- -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Index Scan Backward using _hyper_X_X_chunk__materialized_hypertable_X_time_bucket_idx on _hyper_X_X_chunk - Index Cond: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Finalize GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(16 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Sort + Sort Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time")) + -> Append + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial HashAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Seq Scan on _hyper_X_X_chunk + Filter: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(19 rows) step s3_release_invalidation: SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); diff --git a/tsl/test/isolation/specs/cagg_watermark_concurrent_update.spec b/tsl/test/isolation/specs/cagg_watermark_concurrent_update.spec index 9aa7d0b1bde..642e2eb809a 100644 --- a/tsl/test/isolation/specs/cagg_watermark_concurrent_update.spec +++ b/tsl/test/isolation/specs/cagg_watermark_concurrent_update.spec @@ -46,6 +46,11 @@ setup '2020-01-01 23:59:59+0','1m') time; } +setup +{ + VACUUM ANALYZE; +} + teardown { DROP TABLE temperature CASCADE; } From 91159370e593b22371f17f250fcb26b9abfa6ebd Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:20:55 +0200 Subject: [PATCH 086/157] try order by in caggs --- test/sql/updates/setup.continuous_aggs.sql | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/test/sql/updates/setup.continuous_aggs.sql b/test/sql/updates/setup.continuous_aggs.sql index 6efd9418d9d..c4fd67c5ab1 100644 --- a/test/sql/updates/setup.continuous_aggs.sql +++ b/test/sql/updates/setup.continuous_aggs.sql @@ -47,6 +47,7 @@ SELECT time_bucket('1 week', timec) AS bucket, round(avg(humidity)) AS humidity FROM conditions_before GROUP BY bucket, location +ORDER BY bucket, location WITH NO DATA; CREATE MATERIALIZED VIEW IF NOT EXISTS mat_before @@ -91,7 +92,9 @@ SELECT time_bucket('1week', timec) as bucket, histogram(temperature, 0, 100, 5) FROM conditions_before GROUP BY bucket, location -HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA; +HAVING min(location) >= 'NYC' and avg(temperature) > 2 +ORDER BY bucket, location +WITH NO DATA; ALTER MATERIALIZED VIEW rename_cols RENAME COLUMN bucket TO "time"; @@ -148,7 +151,9 @@ SELECT time_bucket('1week', timec) as bucket, histogram(temperature, 0, 100, 5) FROM conditions_before GROUP BY bucket, location -HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA; +HAVING min(location) >= 'NYC' and avg(temperature) > 2 +ORDER BY bucket, location +WITH NO DATA; \if :WITH_SUPERUSER GRANT SELECT ON cagg.realtime_mat TO cagg_user; @@ -184,7 +189,9 @@ AS SELECT time_bucket('10 minute', time) as bucket, location, min(temperature) as min_temp, max(temperature) as max_temp, round(avg(temperature)) as avg_temp FROM inval_test - GROUP BY bucket, location WITH NO DATA; + GROUP BY bucket, location + ORDER BY bucket, location + WITH NO DATA; SELECT add_continuous_aggregate_policy('mat_inval', NULL, '-20 days'::interval, '12 hours'); @@ -211,14 +218,14 @@ WITH ( timescaledb.continuous, timescaledb.materialized_only=true ) AS SELECT time_bucket( 2, timeval), COUNT(col1) FROM int_time_test - GROUP BY 1 WITH NO DATA; + GROUP BY 1 ORDER BY 1 WITH NO DATA; CREATE MATERIALIZED VIEW mat_inttime2 WITH ( timescaledb.continuous, timescaledb.materialized_only=true ) AS SELECT time_bucket( 2, timeval), COUNT(col1) FROM int_time_test - GROUP BY 1 WITH NO DATA; + GROUP BY 1 ORDER BY 1 WITH NO DATA; SELECT add_continuous_aggregate_policy('mat_inttime', 6, 2, '12 hours'); SELECT add_continuous_aggregate_policy('mat_inttime2', NULL, 2, '12 hours'); @@ -236,7 +243,9 @@ AS SELECT time_bucket('10 minute', time) as bucket, location, min(temperature) as min_temp, max(temperature) as max_temp, round(avg(temperature)) as avg_temp FROM conflict_test - GROUP BY bucket, location WITH NO DATA; + GROUP BY bucket, location + ORDER BY bucket, location + WITH NO DATA; SELECT add_continuous_aggregate_policy('mat_conflict', '28 days', '1 day', '12 hours'); SELECT add_retention_policy('conflict_test', '14 days'::interval) AS retention_jobid \gset @@ -283,9 +292,9 @@ SELECT round(avg(temperature)) AS avg_temp FROM drop_test -GROUP BY - bucket, - LOCATION; +GROUP BY bucket, location +ORDER BY bucket, location +; SELECT add_continuous_aggregate_policy('mat_drop', '7 days', '-30 days'::interval, '20 min'); From 392e342d344413b0204e83e3d0dc3218f56be4e5 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:38:49 +0200 Subject: [PATCH 087/157] reference REL_16_3 append-* parallel-* partitionwise-* query-* cagg_union_view-* cagg_watermark-* continuous_aggs-* transparent_decompression-* --- test/expected/append-16.out | 56 +++--- test/expected/parallel-16.out | 68 ++++--- test/expected/partitionwise-16.out | 184 ++++++++++-------- test/expected/query-16.out | 124 ++++++++---- tsl/test/expected/cagg_union_view-16.out | 109 ++++++----- tsl/test/expected/cagg_watermark-16.out | 184 +++++++++++------- tsl/test/expected/continuous_aggs-16.out | 50 +++-- .../expected/transparent_decompression-16.out | 21 +- 8 files changed, 480 insertions(+), 316 deletions(-) diff --git a/test/expected/append-16.out b/test/expected/append-16.out index be3a4ccf1cc..ec8ae3a10a9 100644 --- a/test/expected/append-16.out +++ b/test/expected/append-16.out @@ -322,17 +322,20 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- - GroupAggregate (actual rows=1 loops=1) + Finalize GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Result (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 + -> Custom Scan (ChunkAppend) on append_test (actual rows=2 loops=1) + Order: date_trunc('year'::text, append_test."time") DESC + Chunks excluded during startup: 1 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: date_trunc('year'::text, _hyper_1_3_chunk."time") -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: date_trunc('year'::text, _hyper_1_2_chunk."time") -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(10 rows) +(13 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -398,8 +401,8 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -409,22 +412,29 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Hash (actual rows=3 loops=1) Buckets: 1024 Batches: 1 -> Subquery Scan on data (actual rows=3 loops=1) - -> HashAggregate (actual rows=3 loops=1) - Group Key: time_bucket('@ 30 days'::interval, append_test."time") - Batches: 1 - -> Result (actual rows=5 loops=1) - -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=3 loops=1) + Group Key: (time_bucket('@ 30 days'::interval, append_test."time")) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket('@ 30 days'::interval, append_test."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(24 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_1_chunk."time") + -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_2_chunk."time") + -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_3_chunk."time") + -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) +(31 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE diff --git a/test/expected/parallel-16.out b/test/expected/parallel-16.out index 01d899fe9f2..5f19ed17949 100644 --- a/test/expected/parallel-16.out +++ b/test/expected/parallel-16.out @@ -72,21 +72,23 @@ FROM "test" GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------- - Gather - Workers Planned: 1 - Single Copy: true - -> Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Result - -> Append - -> Seq Scan on _hyper_1_1_chunk - -> Seq Scan on _hyper_1_2_chunk -(12 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------- + Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Parallel Seq Scan on _hyper_1_1_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) + -> Parallel Seq Scan on _hyper_1_2_chunk +(14 rows) -- test single copy parallel plan with parallel chunk append :PREFIX SELECT time_bucket('1 second', ts) sec, last(i, j) @@ -95,28 +97,30 @@ WHERE length(version()) > 0 GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------- - Gather - Workers Planned: 1 - Single Copy: true - -> Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, test.ts) + QUERY PLAN +-------------------------------------------------------------------------------------------------------- + Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> Gather + Workers Planned: 2 -> Result - -> Result - One-Time Filter: (length(version()) > 0) - -> Custom Scan (ChunkAppend) on test - Chunks excluded during startup: 0 + One-Time Filter: (length(version()) > 0) + -> Parallel Custom Scan (ChunkAppend) on test + Chunks excluded during startup: 0 + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) -> Result One-Time Filter: (length(version()) > 0) - -> Seq Scan on _hyper_1_1_chunk + -> Parallel Seq Scan on _hyper_1_1_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) -> Result One-Time Filter: (length(version()) > 0) - -> Seq Scan on _hyper_1_2_chunk -(19 rows) + -> Parallel Seq Scan on _hyper_1_2_chunk +(21 rows) SELECT time_bucket('1 second', ts) sec, last(i, j) FROM "test" diff --git a/test/expected/partitionwise-16.out b/test/expected/partitionwise-16.out index 831f84d0e79..49ae1cc777c 100644 --- a/test/expected/partitionwise-16.out +++ b/test/expected/partitionwise-16.out @@ -460,55 +460,74 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Also test time_bucket SET timescaledb.enable_chunkwise_aggregation = 'off'; @@ -544,26 +563,36 @@ SELECT time_bucket('1 month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ Sort Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Test partitionwise joins, mostly to see that we do not break -- anything @@ -831,55 +860,58 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - -> GroupAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Incremental Sort - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - Presorted Key: (time_func(_hyper_3_7_chunk."time")) - -> Result - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - -> Merge Append - Sort Key: (time_func(_hyper_3_7_chunk."time")) - -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk - Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") - -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk - Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") -(17 rows) + -> Sort + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) + Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Finalize HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, PARTIAL avg(_hyper_3_7_chunk.temp) + Group Key: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk + Output: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + -> Partial HashAggregate + Output: (time_func(_hyper_3_8_chunk."time")), _hyper_3_8_chunk.device, PARTIAL avg(_hyper_3_8_chunk.temp) + Group Key: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk + Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp +(19 rows) --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - -> GroupAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Incremental Sort - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), _hyper_3_7_chunk.temp - Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - Presorted Key: (time_func(_hyper_3_7_chunk."time")) - -> Result - Output: (time_func(_hyper_3_7_chunk."time")), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp - -> Merge Append - Sort Key: (time_func(_hyper_3_7_chunk."time")) - -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk - Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") - -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk - Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") -(17 rows) + -> Sort + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) + Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Finalize HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Append + -> Partial HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), PARTIAL avg(_hyper_3_7_chunk.temp) + Group Key: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device) + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk + Output: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp + -> Partial HashAggregate + Output: (time_func(_hyper_3_8_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device)), PARTIAL avg(_hyper_3_8_chunk.temp) + Group Key: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device) + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk + Output: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device), _hyper_3_8_chunk.temp +(19 rows) -- Test removal of redundant group key optimization in PG16 -- All lower versions include the redundant key on device column diff --git a/test/expected/query-16.out b/test/expected/query-16.out index 418da001ea4..8447ecba3bd 100644 --- a/test/expected/query-16.out +++ b/test/expected/query-16.out @@ -150,28 +150,54 @@ SHOW timescaledb.enable_optimizations; (5 rows) :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_date GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) - -> Result - -> Merge Append - Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC - -> Index Scan using _hyper_4_6_chunk_time_plain_date on _hyper_4_6_chunk - -> Index Scan using _hyper_4_7_chunk_time_plain_date on _hyper_4_7_chunk - -> Index Scan using _hyper_4_8_chunk_time_plain_date on _hyper_4_8_chunk - -> Index Scan using _hyper_4_9_chunk_time_plain_date on _hyper_4_9_chunk - -> Index Scan using _hyper_4_10_chunk_time_plain_date on _hyper_4_10_chunk - -> Index Scan using _hyper_4_11_chunk_time_plain_date on _hyper_4_11_chunk - -> Index Scan using _hyper_4_12_chunk_time_plain_date on _hyper_4_12_chunk - -> Index Scan using _hyper_4_13_chunk_time_plain_date on _hyper_4_13_chunk - -> Index Scan using _hyper_4_14_chunk_time_plain_date on _hyper_4_14_chunk - -> Index Scan using _hyper_4_15_chunk_time_plain_date on _hyper_4_15_chunk - -> Index Scan using _hyper_4_16_chunk_time_plain_date on _hyper_4_16_chunk - -> Index Scan using _hyper_4_17_chunk_time_plain_date on _hyper_4_17_chunk - -> Index Scan using _hyper_4_18_chunk_time_plain_date on _hyper_4_18_chunk -(19 rows) + -> Sort + Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC + -> Finalize HashAggregate + Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) + -> Append + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_6_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_7_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_7_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_8_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_8_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_9_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_9_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_10_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_10_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_11_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_11_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_12_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_12_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_13_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_13_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_14_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_14_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_15_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_15_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_16_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_16_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_17_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_17_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_18_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_18_chunk +(45 rows) --the minute and second results should be diff :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2; @@ -334,33 +360,45 @@ BEGIN; :PREFIX SELECT time_bucket(10, time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (time_bucket(10, hyper_1_int."time")) - -> Result - -> Custom Scan (ChunkAppend) on hyper_1_int - Order: time_bucket(10, hyper_1_int."time") DESC - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(9 rows) + -> Sort + Sort Key: (time_bucket(10, _hyper_3_5_chunk."time")) DESC + -> Finalize HashAggregate + Group Key: (time_bucket(10, _hyper_3_5_chunk."time")) + -> Append + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_5_chunk."time") + -> Seq Scan on _hyper_3_5_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_4_chunk."time") + -> Seq Scan on _hyper_3_4_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_3_chunk."time") + -> Seq Scan on _hyper_3_3_chunk +(15 rows) :PREFIX SELECT time_bucket(10, time, 2) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (time_bucket(10, hyper_1_int."time", 2)) - -> Result - -> Custom Scan (ChunkAppend) on hyper_1_int - Order: time_bucket(10, hyper_1_int."time", 2) DESC - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(9 rows) + -> Sort + Sort Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) DESC + -> Finalize HashAggregate + Group Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) + -> Append + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_5_chunk."time", 2) + -> Seq Scan on _hyper_3_5_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_4_chunk."time", 2) + -> Seq Scan on _hyper_3_4_chunk + -> Partial HashAggregate + Group Key: time_bucket(10, _hyper_3_3_chunk."time", 2) + -> Seq Scan on _hyper_3_3_chunk +(15 rows) ROLLBACK; -- sort order optimization should not be applied to non-hypertables diff --git a/tsl/test/expected/cagg_union_view-16.out b/tsl/test/expected/cagg_union_view-16.out index 25d63a57593..a25c34d9d19 100644 --- a/tsl/test/expected/cagg_union_view-16.out +++ b/tsl/test/expected/cagg_union_view-16.out @@ -354,22 +354,31 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- - HashAggregate (actual rows=4 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - Batches: 1 - -> Result (actual rows=4 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=4 loops=1) + Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) + -> Sort (actual rows=4 loops=1) + Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) + Sort Method: quicksort -> Append (actual rows=4 loops=1) - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(13 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(22 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -393,21 +402,26 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - Batches: 1 - -> Result (actual rows=2 loops=1) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) + -> Sort (actual rows=2 loops=1) + Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) + Sort Method: quicksort -> Append (actual rows=2 loops=1) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(12 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(17 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -577,32 +591,39 @@ ORDER by 1; -- plan output :PREFIX SELECT * FROM mat_m1 ORDER BY 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=3 loops=1) Sort Key: _hyper_9_15_chunk.time_bucket Sort Method: quicksort -> Append (actual rows=3 loops=1) -> Index Scan using _hyper_9_15_chunk__materialized_hypertable_9_time_bucket_idx on _hyper_9_15_chunk (actual rows=1 loops=1) Index Cond: (time_bucket < 25) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(5, _hyper_7_11_chunk.a)) Filter: ((sum(_hyper_7_11_chunk.c) > 50) AND ((avg(_hyper_7_11_chunk.b))::integer > 12)) - Batches: 1 Rows Removed by Filter: 1 - -> Result (actual rows=6 loops=1) - -> Append (actual rows=6 loops=1) - -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - Rows Removed by Filter: 2 -(23 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket(5, _hyper_7_11_chunk.a)) + Sort Method: quicksort + -> Append (actual rows=3 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_13_chunk.a) + -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_14_chunk.a) + -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + Rows Removed by Filter: 2 +(30 rows) -- Test caggs with different time types CREATE TABLE smallint_table (time smallint, value int); diff --git a/tsl/test/expected/cagg_watermark-16.out b/tsl/test/expected/cagg_watermark-16.out index 8800c7c5125..da9a5017370 100644 --- a/tsl/test/expected/cagg_watermark-16.out +++ b/tsl/test/expected/cagg_watermark-16.out @@ -467,16 +467,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -484,16 +489,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); :EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; @@ -502,18 +512,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -521,18 +539,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) -- Materialize CAgg and check for plan time chunk exclusion CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); @@ -1187,15 +1213,17 @@ CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 1 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 1 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_49_chunk."time"), _hyper_7_49_chunk.device + Batches: 1 -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(43 rows) +(45 rows) RESET timescaledb.enable_cagg_watermark_constify; -- Select with projection @@ -1304,12 +1332,14 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Append (actual rows=3 loops=1) @@ -1353,15 +1383,17 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Result (actual rows=0 loops=1) One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks_1."time"), chunks_1.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks_1."time")), chunks_1.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk_1."time"), _hyper_7_51_chunk_1.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(94 rows) +(98 rows) -- Aggregation query over CAgg should be constified :EXPLAIN_ANALYZE SELECT max(device) from chunks_1h; @@ -1576,31 +1608,39 @@ UNION ALL FROM small_integer_ht WHERE small_integer_ht."time" < COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) GROUP BY (time_bucket(5, small_integer_ht."time")); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=6 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht."time") - Batches: 1 - -> Result (actual rows=0 loops=1) + -> Finalize GroupAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht."time")) + -> Sort (actual rows=0 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht."time")) + Sort Method: quicksort -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) Chunks excluded during startup: 3 - -> HashAggregate (actual rows=6 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht_1."time") - Batches: 1 - -> Result (actual rows=26 loops=1) - -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=26 loops=1) + -> Finalize GroupAggregate (actual rows=6 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + -> Sort (actual rows=6 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=6 loops=1) Chunks excluded during startup: 0 - -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 6 -(22 rows) + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_61_chunk."time") + -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_62_chunk."time") + -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_63_chunk."time") + -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 6 +(30 rows) -- test with non constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1661,16 +1701,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(55 rows) +(57 rows) -- test with NULL constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1731,16 +1773,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 - -> Result (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 + -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) + Chunks excluded during startup: 2 + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(55 rows) +(57 rows) -- test with double COALESCE function (should be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max diff --git a/tsl/test/expected/continuous_aggs-16.out b/tsl/test/expected/continuous_aggs-16.out index e0c064d0d14..05f61c2ddb0 100644 --- a/tsl/test/expected/continuous_aggs-16.out +++ b/tsl/test/expected/continuous_aggs-16.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2047,15 +2047,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(18 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(23 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2068,8 +2073,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2082,15 +2087,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(20 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(25 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index d6d583e1634..ba2e9a2c5ff 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -9400,22 +9400,27 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; (10 rows) EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v0 FROM metrics GROUP BY bucket; - QUERY PLAN --------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Finalize HashAggregate Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather Workers Planned: 3 - -> Partial HashAggregate - Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") - -> Result - -> Parallel Append + -> Parallel Append + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") + -> Result -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") + -> Result -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk -> Parallel Seq Scan on compress_hyper_5_16_chunk - -> Parallel Seq Scan on _hyper_1_2_chunk -(13 rows) + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_2_chunk."time") + -> Parallel Seq Scan on _hyper_1_2_chunk +(18 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN From 8f23e8bef6f49735032189e870fc461fd3e13762 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:40:43 +0200 Subject: [PATCH 088/157] reference REL_14_11 append-* parallel-* partitionwise-* query-* cagg_union_view-* cagg_watermark-* continuous_aggs-* transparent_decompression-* --- test/expected/append-14.out | 64 +++--- test/expected/parallel-14.out | 71 ++++--- test/expected/partitionwise-14.out | 184 ++++++++++------- test/expected/query-14.out | 108 ++++++---- tsl/test/expected/cagg_union_view-14.out | 109 ++++++---- tsl/test/expected/cagg_watermark-14.out | 195 +++++++++++------- tsl/test/expected/continuous_aggs-14.out | 50 +++-- .../expected/transparent_decompression-14.out | 27 +-- 8 files changed, 490 insertions(+), 318 deletions(-) diff --git a/test/expected/append-14.out b/test/expected/append-14.out index a3928f14890..14c455c6348 100644 --- a/test/expected/append-14.out +++ b/test/expected/append-14.out @@ -320,18 +320,22 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- - GroupAggregate (actual rows=1 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=2 loops=1) Order: date_trunc('year'::text, append_test."time") DESC Chunks excluded during startup: 1 - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(9 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: date_trunc('year'::text, _hyper_1_3_chunk."time") + -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: date_trunc('year'::text, _hyper_1_2_chunk."time") + -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) +(13 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -397,8 +401,8 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -408,21 +412,29 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Hash (actual rows=3 loops=1) Buckets: 1024 Batches: 1 -> Subquery Scan on data (actual rows=3 loops=1) - -> HashAggregate (actual rows=3 loops=1) - Group Key: time_bucket('@ 30 days'::interval, append_test."time") - Batches: 1 - -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) - Chunks excluded during startup: 0 - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(23 rows) + -> Finalize GroupAggregate (actual rows=3 loops=1) + Group Key: (time_bucket('@ 30 days'::interval, append_test."time")) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket('@ 30 days'::interval, append_test."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Chunks excluded during startup: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_1_chunk."time") + -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_2_chunk."time") + -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 30 days'::interval, _hyper_1_3_chunk."time") + -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) +(31 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE diff --git a/test/expected/parallel-14.out b/test/expected/parallel-14.out index 845fe60993f..2b686d6aa2f 100644 --- a/test/expected/parallel-14.out +++ b/test/expected/parallel-14.out @@ -72,21 +72,23 @@ FROM "test" GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------- - Gather - Workers Planned: 1 - Single Copy: true - -> Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Result - -> Append - -> Seq Scan on _hyper_1_1_chunk - -> Seq Scan on _hyper_1_2_chunk -(12 rows) + QUERY PLAN +-------------------------------------------------------------------------------------------------- + Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Parallel Seq Scan on _hyper_1_1_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) + -> Parallel Seq Scan on _hyper_1_2_chunk +(14 rows) -- test single copy parallel plan with parallel chunk append :PREFIX SELECT time_bucket('1 second', ts) sec, last(i, j) @@ -95,27 +97,30 @@ WHERE length(version()) > 0 GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------- - Gather - Workers Planned: 1 - Single Copy: true - -> Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, test.ts) + QUERY PLAN +-------------------------------------------------------------------------------------------------------- + Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> Finalize HashAggregate + Group Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> Gather + Workers Planned: 2 -> Result One-Time Filter: (length(version()) > 0) - -> Custom Scan (ChunkAppend) on test + -> Parallel Custom Scan (ChunkAppend) on test Chunks excluded during startup: 0 - -> Result - One-Time Filter: (length(version()) > 0) - -> Seq Scan on _hyper_1_1_chunk - -> Result - One-Time Filter: (length(version()) > 0) - -> Seq Scan on _hyper_1_2_chunk -(18 rows) + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Result + One-Time Filter: (length(version()) > 0) + -> Parallel Seq Scan on _hyper_1_1_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) + -> Result + One-Time Filter: (length(version()) > 0) + -> Parallel Seq Scan on _hyper_1_2_chunk +(21 rows) SELECT time_bucket('1 second', ts) sec, last(i, j) FROM "test" diff --git a/test/expected/partitionwise-14.out b/test/expected/partitionwise-14.out index ea178ed5813..602694003bb 100644 --- a/test/expected/partitionwise-14.out +++ b/test/expected/partitionwise-14.out @@ -460,55 +460,74 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Also test time_bucket SET timescaledb.enable_chunkwise_aggregation = 'off'; @@ -544,26 +563,36 @@ SELECT time_bucket('1 month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ Sort Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> HashAggregate + -> Finalize HashAggregate Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device - -> Result - Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Append + Group Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + Output: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp + -> Partial HashAggregate + Output: (time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(17 rows) + Output: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(27 rows) -- Test partitionwise joins, mostly to see that we do not break -- anything @@ -831,55 +860,58 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - -> GroupAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Incremental Sort - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - Presorted Key: (time_func(_hyper_3_7_chunk."time")) - -> Result - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - -> Merge Append - Sort Key: (time_func(_hyper_3_7_chunk."time")) - -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk - Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") - -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk - Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") -(17 rows) + -> Sort + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) + Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Finalize HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Append + -> Partial HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, PARTIAL avg(_hyper_3_7_chunk.temp) + Group Key: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk + Output: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + -> Partial HashAggregate + Output: (time_func(_hyper_3_8_chunk."time")), _hyper_3_8_chunk.device, PARTIAL avg(_hyper_3_8_chunk.temp) + Group Key: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk + Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp +(19 rows) --- Partial aggregation pushdown is currently not supported for this query by --- the TSDB pushdown code since a projection is used in the path. +-- Partial aggregation pushdown when a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - -> GroupAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Incremental Sort - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), _hyper_3_7_chunk.temp - Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - Presorted Key: (time_func(_hyper_3_7_chunk."time")) - -> Result - Output: (time_func(_hyper_3_7_chunk."time")), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp - -> Merge Append - Sort Key: (time_func(_hyper_3_7_chunk."time")) - -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk - Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") - -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk - Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") -(17 rows) + -> Sort + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) + Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Finalize HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Append + -> Partial HashAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), PARTIAL avg(_hyper_3_7_chunk.temp) + Group Key: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device) + -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk + Output: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp + -> Partial HashAggregate + Output: (time_func(_hyper_3_8_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device)), PARTIAL avg(_hyper_3_8_chunk.temp) + Group Key: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device) + -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk + Output: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device), _hyper_3_8_chunk.temp +(19 rows) -- Test removal of redundant group key optimization in PG16 -- All lower versions include the redundant key on device column diff --git a/test/expected/query-14.out b/test/expected/query-14.out index 2289eabfa05..0faea17ad7a 100644 --- a/test/expected/query-14.out +++ b/test/expected/query-14.out @@ -150,28 +150,54 @@ SHOW timescaledb.enable_optimizations; (5 rows) :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_date GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- Limit - -> GroupAggregate - Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) - -> Result - -> Merge Append - Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC - -> Index Scan using _hyper_4_6_chunk_time_plain_date on _hyper_4_6_chunk - -> Index Scan using _hyper_4_7_chunk_time_plain_date on _hyper_4_7_chunk - -> Index Scan using _hyper_4_8_chunk_time_plain_date on _hyper_4_8_chunk - -> Index Scan using _hyper_4_9_chunk_time_plain_date on _hyper_4_9_chunk - -> Index Scan using _hyper_4_10_chunk_time_plain_date on _hyper_4_10_chunk - -> Index Scan using _hyper_4_11_chunk_time_plain_date on _hyper_4_11_chunk - -> Index Scan using _hyper_4_12_chunk_time_plain_date on _hyper_4_12_chunk - -> Index Scan using _hyper_4_13_chunk_time_plain_date on _hyper_4_13_chunk - -> Index Scan using _hyper_4_14_chunk_time_plain_date on _hyper_4_14_chunk - -> Index Scan using _hyper_4_15_chunk_time_plain_date on _hyper_4_15_chunk - -> Index Scan using _hyper_4_16_chunk_time_plain_date on _hyper_4_16_chunk - -> Index Scan using _hyper_4_17_chunk_time_plain_date on _hyper_4_17_chunk - -> Index Scan using _hyper_4_18_chunk_time_plain_date on _hyper_4_18_chunk -(19 rows) + -> Sort + Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC + -> Finalize HashAggregate + Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) + -> Append + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_6_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_7_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_7_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_8_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_8_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_9_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_9_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_10_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_10_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_11_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_11_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_12_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_12_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_13_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_13_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_14_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_14_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_15_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_15_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_16_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_16_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_17_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_17_chunk + -> Partial HashAggregate + Group Key: date_trunc('minute'::text, (_hyper_4_18_chunk."time")::timestamp with time zone) + -> Seq Scan on _hyper_4_18_chunk +(45 rows) --the minute and second results should be diff :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2; @@ -333,31 +359,43 @@ BEGIN; :PREFIX SELECT time_bucket(10, time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Limit - -> GroupAggregate + -> Finalize GroupAggregate Group Key: (time_bucket(10, hyper_1_int."time")) -> Custom Scan (ChunkAppend) on hyper_1_int Order: time_bucket(10, hyper_1_int."time") DESC - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(8 rows) + -> Partial GroupAggregate + Group Key: time_bucket(10, _hyper_3_5_chunk."time") + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Partial GroupAggregate + Group Key: time_bucket(10, _hyper_3_4_chunk."time") + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Partial GroupAggregate + Group Key: time_bucket(10, _hyper_3_3_chunk."time") + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(14 rows) :PREFIX SELECT time_bucket(10, time, 2) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Limit - -> GroupAggregate + -> Finalize GroupAggregate Group Key: (time_bucket(10, hyper_1_int."time", 2)) -> Custom Scan (ChunkAppend) on hyper_1_int Order: time_bucket(10, hyper_1_int."time", 2) DESC - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(8 rows) + -> Partial GroupAggregate + Group Key: time_bucket(10, _hyper_3_5_chunk."time", 2) + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Partial GroupAggregate + Group Key: time_bucket(10, _hyper_3_4_chunk."time", 2) + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Partial GroupAggregate + Group Key: time_bucket(10, _hyper_3_3_chunk."time", 2) + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(14 rows) ROLLBACK; -- sort order optimization should not be applied to non-hypertables diff --git a/tsl/test/expected/cagg_union_view-14.out b/tsl/test/expected/cagg_union_view-14.out index 24a7a3eda40..7b769ad257b 100644 --- a/tsl/test/expected/cagg_union_view-14.out +++ b/tsl/test/expected/cagg_union_view-14.out @@ -354,22 +354,31 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------- - HashAggregate (actual rows=4 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - Batches: 1 - -> Result (actual rows=4 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- + Finalize GroupAggregate (actual rows=4 loops=1) + Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) + -> Sort (actual rows=4 loops=1) + Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) + Sort Method: quicksort -> Append (actual rows=4 loops=1) - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(13 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(22 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -393,21 +402,26 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - Batches: 1 - -> Result (actual rows=2 loops=1) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) + -> Sort (actual rows=2 loops=1) + Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) + Sort Method: quicksort -> Append (actual rows=2 loops=1) - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(12 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(17 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -577,32 +591,39 @@ ORDER by 1; -- plan output :PREFIX SELECT * FROM mat_m1 ORDER BY 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=3 loops=1) Sort Key: _hyper_9_15_chunk.time_bucket Sort Method: quicksort -> Append (actual rows=3 loops=1) -> Index Scan using _hyper_9_15_chunk__materialized_hypertable_9_time_bucket_idx on _hyper_9_15_chunk (actual rows=1 loops=1) Index Cond: (time_bucket < 25) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Group Key: (time_bucket(5, _hyper_7_11_chunk.a)) Filter: ((sum(_hyper_7_11_chunk.c) > 50) AND ((avg(_hyper_7_11_chunk.b))::integer > 12)) - Batches: 1 Rows Removed by Filter: 1 - -> Result (actual rows=6 loops=1) - -> Append (actual rows=6 loops=1) - -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - Rows Removed by Filter: 2 -(23 rows) + -> Sort (actual rows=3 loops=1) + Sort Key: (time_bucket(5, _hyper_7_11_chunk.a)) + Sort Method: quicksort + -> Append (actual rows=3 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_13_chunk.a) + -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_14_chunk.a) + -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + Rows Removed by Filter: 2 +(30 rows) -- Test caggs with different time types CREATE TABLE smallint_table (time smallint, value int); diff --git a/tsl/test/expected/cagg_watermark-14.out b/tsl/test/expected/cagg_watermark-14.out index 41184f6ac40..da9a5017370 100644 --- a/tsl/test/expected/cagg_watermark-14.out +++ b/tsl/test/expected/cagg_watermark-14.out @@ -467,16 +467,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -484,16 +489,21 @@ INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); Append (actual rows=2 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=1 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) + -> Append (actual rows=1 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(12 rows) +(17 rows) INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); :EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; @@ -502,18 +512,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) :EXPLAIN_ANALYZE SELECT * FROM chunks_1h; QUERY PLAN @@ -521,18 +539,26 @@ INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); Append (actual rows=3 loops=1) -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=2 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + -> Finalize HashAggregate (actual rows=2 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device Batches: 1 - -> Result (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) + -> Append (actual rows=2 loops=1) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device + Batches: 1 -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device + Batches: 1 -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) + -> Partial HashAggregate (actual rows=1 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device + Batches: 1 -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(14 rows) +(22 rows) -- Materialize CAgg and check for plan time chunk exclusion CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); @@ -1150,8 +1176,8 @@ SET timescaledb.enable_cagg_watermark_constify = OFF; INSERT INTO chunks VALUES ('2014-01-01 01:01:01+01', 1, 2); CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); :EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=2 loops=1) -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=2 loops=1) Chunks excluded during startup: 0 @@ -1187,14 +1213,17 @@ CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) Chunks excluded during startup: 1 - -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(42 rows) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_49_chunk."time"), _hyper_7_49_chunk.device + Batches: 1 + -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) + Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) +(45 rows) RESET timescaledb.enable_cagg_watermark_constify; -- Select with projection @@ -1264,8 +1293,8 @@ CREATE TABLE continuous_agg_test(time int, data int); -- Query without COALESCE - should not be optimized :EXPLAIN_ANALYZE (SELECT * FROM chunks_1h AS t1) UNION ALL (SELECT * from chunks_1h AS t2 WHERE _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)) IS NOT NULL); - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=6 loops=1) -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) Chunks excluded during startup: 0 @@ -1303,13 +1332,16 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 + -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) + Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Append (actual rows=3 loops=1) -> Result (actual rows=3 loops=1) One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) @@ -1351,14 +1383,17 @@ CREATE TABLE continuous_agg_test(time int, data int); Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -> Result (actual rows=0 loops=1) One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks_1."time"), chunks_1.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks_1."time")), chunks_1.device Batches: 1 -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(92 rows) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk_1."time"), _hyper_7_51_chunk_1.device + Batches: 1 + -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) + Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) +(98 rows) -- Aggregation query over CAgg should be constified :EXPLAIN_ANALYZE SELECT max(device) from chunks_1h; @@ -1573,29 +1608,39 @@ UNION ALL FROM small_integer_ht WHERE small_integer_ht."time" < COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) GROUP BY (time_bucket(5, small_integer_ht."time")); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=6 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht."time") - Batches: 1 - -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) - Chunks excluded during startup: 3 - -> HashAggregate (actual rows=6 loops=1) - Group Key: time_bucket('5'::bigint, small_integer_ht_1."time") - Batches: 1 - -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=26 loops=1) - Chunks excluded during startup: 0 - -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 6 -(20 rows) + -> Finalize GroupAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht."time")) + -> Sort (actual rows=0 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) + Chunks excluded during startup: 3 + -> Finalize GroupAggregate (actual rows=6 loops=1) + Group Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + -> Sort (actual rows=6 loops=1) + Sort Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) + Sort Method: quicksort + -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=6 loops=1) + Chunks excluded during startup: 0 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_61_chunk."time") + -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_62_chunk."time") + -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 10 + -> Partial GroupAggregate (actual rows=2 loops=1) + Group Key: time_bucket('5'::bigint, _hyper_14_63_chunk."time") + -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) + Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) + Heap Fetches: 6 +(30 rows) -- test with non constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1656,15 +1701,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(54 rows) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 + -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) + Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) + Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) +(57 rows) -- test with NULL constant value of the watermark function (should not be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max @@ -1725,15 +1773,18 @@ UNION ALL Chunks excluded during startup: 16 -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device + -> Finalize HashAggregate (actual rows=0 loops=1) + Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device Batches: 1 -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) Chunks excluded during startup: 2 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(54 rows) + -> Partial HashAggregate (actual rows=0 loops=1) + Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device + Batches: 1 + -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) + Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) + Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) +(57 rows) -- test with double COALESCE function (should be constified) :EXPLAIN_ANALYZE SELECT bucket, device, max diff --git a/tsl/test/expected/continuous_aggs-14.out b/tsl/test/expected/continuous_aggs-14.out index 3a9e83e9463..decbc17e3cd 100644 --- a/tsl/test/expected/continuous_aggs-14.out +++ b/tsl/test/expected/continuous_aggs-14.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------- Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2047,15 +2047,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(18 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(23 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2068,8 +2073,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------- Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2082,15 +2087,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Index Cond: (time_bucket < 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -> Sort Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC - -> HashAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Result + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) + -> Sort + Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) -> Append - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(20 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(25 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 78e1a02b51f..b4f1579e2a6 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -9399,22 +9399,25 @@ EXPLAIN (costs off) SELECT * FROM metrics ORDER BY time, device_id; (10 rows) EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v0 FROM metrics GROUP BY bucket; - QUERY PLAN --------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------- Finalize HashAggregate Group Key: (time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time")) -> Gather Workers Planned: 3 - -> Partial HashAggregate - Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") - -> Result - -> Parallel Append - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk - -> Parallel Seq Scan on _hyper_1_2_chunk -(13 rows) + -> Parallel Append + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk + -> Partial HashAggregate + Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_2_chunk."time") + -> Parallel Seq Scan on _hyper_1_2_chunk +(16 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN From a9168f671b3e2a1fa77342ba60839ee4cfac0b58 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:48:09 +0200 Subject: [PATCH 089/157] try another way --- test/sql/updates/setup.continuous_aggs.sql | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/sql/updates/setup.continuous_aggs.sql b/test/sql/updates/setup.continuous_aggs.sql index c4fd67c5ab1..db2b7e3f4f9 100644 --- a/test/sql/updates/setup.continuous_aggs.sql +++ b/test/sql/updates/setup.continuous_aggs.sql @@ -11,6 +11,12 @@ -- on timescaledb 1.7.x CALL _timescaledb_testing.stop_workers(); +-- disable chunkwise aggregation and hash aggregation, because it might lead to +-- different order of chunk creation in the cagg table, based on the underlying +-- aggregation plan. +SET timescaledb.enable_chunkwise_aggregation TO OFF; +SET enable_hashagg TO OFF; + CREATE TYPE custom_type AS (high int, low int); CREATE TABLE conditions_before ( @@ -47,7 +53,6 @@ SELECT time_bucket('1 week', timec) AS bucket, round(avg(humidity)) AS humidity FROM conditions_before GROUP BY bucket, location -ORDER BY bucket, location WITH NO DATA; CREATE MATERIALIZED VIEW IF NOT EXISTS mat_before @@ -92,9 +97,7 @@ SELECT time_bucket('1week', timec) as bucket, histogram(temperature, 0, 100, 5) FROM conditions_before GROUP BY bucket, location -HAVING min(location) >= 'NYC' and avg(temperature) > 2 -ORDER BY bucket, location -WITH NO DATA; +HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA; ALTER MATERIALIZED VIEW rename_cols RENAME COLUMN bucket TO "time"; @@ -151,9 +154,7 @@ SELECT time_bucket('1week', timec) as bucket, histogram(temperature, 0, 100, 5) FROM conditions_before GROUP BY bucket, location -HAVING min(location) >= 'NYC' and avg(temperature) > 2 -ORDER BY bucket, location -WITH NO DATA; +HAVING min(location) >= 'NYC' and avg(temperature) > 2 WITH NO DATA; \if :WITH_SUPERUSER GRANT SELECT ON cagg.realtime_mat TO cagg_user; @@ -189,9 +190,7 @@ AS SELECT time_bucket('10 minute', time) as bucket, location, min(temperature) as min_temp, max(temperature) as max_temp, round(avg(temperature)) as avg_temp FROM inval_test - GROUP BY bucket, location - ORDER BY bucket, location - WITH NO DATA; + GROUP BY bucket, location WITH NO DATA; SELECT add_continuous_aggregate_policy('mat_inval', NULL, '-20 days'::interval, '12 hours'); @@ -218,14 +217,14 @@ WITH ( timescaledb.continuous, timescaledb.materialized_only=true ) AS SELECT time_bucket( 2, timeval), COUNT(col1) FROM int_time_test - GROUP BY 1 ORDER BY 1 WITH NO DATA; + GROUP BY 1 WITH NO DATA; CREATE MATERIALIZED VIEW mat_inttime2 WITH ( timescaledb.continuous, timescaledb.materialized_only=true ) AS SELECT time_bucket( 2, timeval), COUNT(col1) FROM int_time_test - GROUP BY 1 ORDER BY 1 WITH NO DATA; + GROUP BY 1 WITH NO DATA; SELECT add_continuous_aggregate_policy('mat_inttime', 6, 2, '12 hours'); SELECT add_continuous_aggregate_policy('mat_inttime2', NULL, 2, '12 hours'); @@ -243,9 +242,7 @@ AS SELECT time_bucket('10 minute', time) as bucket, location, min(temperature) as min_temp, max(temperature) as max_temp, round(avg(temperature)) as avg_temp FROM conflict_test - GROUP BY bucket, location - ORDER BY bucket, location - WITH NO DATA; + GROUP BY bucket, location WITH NO DATA; SELECT add_continuous_aggregate_policy('mat_conflict', '28 days', '1 day', '12 hours'); SELECT add_retention_policy('conflict_test', '14 days'::interval) AS retention_jobid \gset @@ -292,12 +289,15 @@ SELECT round(avg(temperature)) AS avg_temp FROM drop_test -GROUP BY bucket, location -ORDER BY bucket, location -; +GROUP BY + bucket, + LOCATION; SELECT add_continuous_aggregate_policy('mat_drop', '7 days', '-30 days'::interval, '20 min'); CALL refresh_continuous_aggregate('mat_drop',NULL,NULL); SELECT drop_chunks('drop_test', NOW() - INTERVAL '7 days'); + +RESET timescaledb.enable_chunkwise_aggregation; +RESET enable_hashagg; From fb9e1acbff40e29c05a70d7f464c332be04873f3 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:51:30 +0200 Subject: [PATCH 090/157] unify test --- tsl/test/expected/cagg_watermark-15.out | 1873 ----------------- tsl/test/expected/cagg_watermark-16.out | 1873 ----------------- ...gg_watermark-14.out => cagg_watermark.out} | 0 tsl/test/sql/CMakeLists.txt | 2 +- ...gg_watermark.sql.in => cagg_watermark.sql} | 0 5 files changed, 1 insertion(+), 3747 deletions(-) delete mode 100644 tsl/test/expected/cagg_watermark-15.out delete mode 100644 tsl/test/expected/cagg_watermark-16.out rename tsl/test/expected/{cagg_watermark-14.out => cagg_watermark.out} (100%) rename tsl/test/sql/{cagg_watermark.sql.in => cagg_watermark.sql} (100%) diff --git a/tsl/test/expected/cagg_watermark-15.out b/tsl/test/expected/cagg_watermark-15.out deleted file mode 100644 index da9a5017370..00000000000 --- a/tsl/test/expected/cagg_watermark-15.out +++ /dev/null @@ -1,1873 +0,0 @@ --- This file and its contents are licensed under the Timescale License. --- Please see the included NOTICE for copyright information and --- LICENSE-TIMESCALE for a copy of the license. -\set EXPLAIN_ANALYZE 'EXPLAIN (analyze,costs off,timing off,summary off)' -CREATE TABLE continuous_agg_test(time int, data int); -SELECT create_hypertable('continuous_agg_test', 'time', chunk_time_interval=> 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ----------------------------------- - (1,public,continuous_agg_test,t) -(1 row) - -CREATE OR REPLACE FUNCTION integer_now_test1() returns int LANGUAGE SQL STABLE as $$ SELECT coalesce(max(time), 0) FROM continuous_agg_test $$; -SELECT set_integer_now_func('continuous_agg_test', 'integer_now_test1'); - set_integer_now_func ----------------------- - -(1 row) - --- watermark tabels start out empty -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- -(0 rows) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - --- inserting into a table that does not have continuous_agg_insert_trigger doesn't change the watermark -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2), (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- -(0 rows) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -CREATE TABLE continuous_agg_test_mat(time int); -SELECT create_hypertable('continuous_agg_test_mat', 'time', chunk_time_interval=> 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable --------------------------------------- - (2,public,continuous_agg_test_mat,t) -(1 row) - -INSERT INTO _timescaledb_catalog.continuous_agg VALUES (2, 1, NULL, '', '', '', '', '', ''); -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- create the trigger -CREATE TRIGGER continuous_agg_insert_trigger - AFTER INSERT ON continuous_agg_test - FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.continuous_agg_invalidation_trigger(1); --- inserting into the table still doesn't change the watermark since there's no --- continuous_aggs_invalidation_threshold. We treat that case as a invalidation_watermark of --- BIG_INT_MIN, since the first run of the aggregation will need to scan the --- entire table anyway. -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2), (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- -(0 rows) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - --- set the continuous_aggs_invalidation_threshold to 15, any insertions below that value need an invalidation -\c :TEST_DBNAME :ROLE_SUPERUSER -INSERT INTO _timescaledb_catalog.continuous_aggs_invalidation_threshold VALUES (1, 15); -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2), (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 -(1 row) - --- INSERTs only above the continuous_aggs_invalidation_threshold won't change the continuous_aggs_hypertable_invalidation_log -INSERT INTO continuous_agg_test VALUES (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 -(1 row) - --- INSERTs only below the continuous_aggs_invalidation_threshold will change the continuous_aggs_hypertable_invalidation_log -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 -(2 rows) - --- test INSERTing other values -INSERT INTO continuous_agg_test VALUES (1, 7), (12, 6), (24, 5), (51, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 -(3 rows) - --- INSERT after dropping a COLUMN -ALTER TABLE continuous_agg_test DROP COLUMN data; -INSERT INTO continuous_agg_test VALUES (-1), (-2), (-3), (-4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 -(4 rows) - -INSERT INTO continuous_agg_test VALUES (100); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 -(4 rows) - --- INSERT after adding a COLUMN -ALTER TABLE continuous_agg_test ADD COLUMN d BOOLEAN; -INSERT INTO continuous_agg_test VALUES (-6, true), (-7, false), (-3, true), (-4, false); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 - 1 | -7 | -3 -(5 rows) - -INSERT INTO continuous_agg_test VALUES (120, false), (200, true); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 - 1 | -7 | -3 -(5 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -DELETE FROM _timescaledb_catalog.continuous_agg where mat_hypertable_id = 2; -DELETE FROM _timescaledb_config.bgw_job WHERE id = 2; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -DROP TABLE continuous_agg_test CASCADE; -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -TRUNCATE _timescaledb_catalog.continuous_aggs_invalidation_threshold; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- CREATE VIEW creates the invalidation trigger correctly -CREATE TABLE ca_inval_test(time int); -SELECT create_hypertable('ca_inval_test', 'time', chunk_time_interval=> 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ----------------------------- - (3,public,ca_inval_test,t) -(1 row) - -CREATE OR REPLACE FUNCTION integer_now_test2() returns int LANGUAGE SQL STABLE as $$ SELECT coalesce(max(time), 0) FROM ca_inval_test $$; -SELECT set_integer_now_func('ca_inval_test', 'integer_now_test2'); - set_integer_now_func ----------------------- - -(1 row) - -CREATE MATERIALIZED VIEW cit_view - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM ca_inval_test - GROUP BY 1 WITH NO DATA; -INSERT INTO ca_inval_test SELECT generate_series(0, 5); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+------------- - 3 | -2147483648 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -UPDATE _timescaledb_catalog.continuous_aggs_invalidation_threshold -SET watermark = 15 -WHERE hypertable_id = 3; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -INSERT INTO ca_inval_test SELECT generate_series(5, 15); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 3 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 3 | 5 | 15 -(1 row) - -INSERT INTO ca_inval_test SELECT generate_series(16, 20); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 3 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 3 | 5 | 15 -(1 row) - -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- updates below the threshold update both the old and new values -UPDATE ca_inval_test SET time = 5 WHERE time = 6; -UPDATE ca_inval_test SET time = 7 WHERE time = 5; -UPDATE ca_inval_test SET time = 17 WHERE time = 14; -UPDATE ca_inval_test SET time = 12 WHERE time = 16; --- updates purely above the threshold are not logged -UPDATE ca_inval_test SET time = 19 WHERE time = 18; -UPDATE ca_inval_test SET time = 17 WHERE time = 19; -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 3 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 3 | 5 | 6 - 3 | 5 | 7 - 3 | 14 | 17 - 3 | 12 | 16 -(4 rows) - -DROP TABLE ca_inval_test CASCADE; -NOTICE: drop cascades to 3 other objects -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -TRUNCATE _timescaledb_catalog.continuous_aggs_invalidation_threshold; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- invalidation trigger is created correctly on chunks that existed before --- the view was created -CREATE TABLE ts_continuous_test(time INTEGER, location INTEGER); - SELECT create_hypertable('ts_continuous_test', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ---------------------------------- - (5,public,ts_continuous_test,t) -(1 row) - -CREATE OR REPLACE FUNCTION integer_now_test3() returns int LANGUAGE SQL STABLE as $$ SELECT coalesce(max(time), 0) FROM ts_continuous_test $$; -SELECT set_integer_now_func('ts_continuous_test', 'integer_now_test3'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO ts_continuous_test SELECT i, i FROM - (SELECT generate_series(0, 29) AS i) AS i; -CREATE MATERIALIZED VIEW continuous_view - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(location) - FROM ts_continuous_test - GROUP BY 1 WITH NO DATA; -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+------------- - 5 | -2147483648 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -UPDATE _timescaledb_catalog.continuous_aggs_invalidation_threshold -SET watermark = 2 -WHERE hypertable_id = 5; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -INSERT INTO ts_continuous_test VALUES (1, 1); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 5 | 2 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 5 | 1 | 1 -(1 row) - --- aborts don't get written -BEGIN; - INSERT INTO ts_continuous_test VALUES (-20, -20); -ABORT; -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 5 | 2 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 5 | 1 | 1 -(1 row) - -DROP TABLE ts_continuous_test CASCADE; -NOTICE: drop cascades to 3 other objects ----- --- Test watermark invalidation and chunk exclusion with prepared and ad-hoc queries ----- -CREATE TABLE chunks(time timestamptz, device int, value float); -SELECT FROM create_hypertable('chunks','time',chunk_time_interval:='1d'::interval); -NOTICE: adding not-null constraint to column "time" --- -(1 row) - -CREATE MATERIALIZED VIEW chunks_1h WITH (timescaledb.continuous, timescaledb.materialized_only = false) - AS SELECT time_bucket('1 hour', time) AS bucket, device, max(value) AS max FROM chunks GROUP BY 1, 2; -NOTICE: continuous aggregate "chunks_1h" is already up-to-date --- Get id of the materialization hypertable -SELECT id AS "MAT_HT_ID_1H" FROM _timescaledb_catalog.hypertable - WHERE table_name=( - SELECT materialization_hypertable_name - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1h' - ) \gset -SELECT materialization_hypertable_schema || '.' || materialization_hypertable_name AS "MAT_HT_NAME_1H" - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1h' -\gset --- Prepared scan on hypertable (identical to the query of a real-time CAgg) -PREPARE ht_scan_realtime_1h AS - SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('01:00:00'::interval, chunks."time") AS bucket, - chunks.device, - max(chunks.value) AS max - FROM chunks - WHERE chunks."time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('01:00:00'::interval, chunks."time")), chunks.device; -PREPARE cagg_scan_1h AS SELECT * FROM chunks_1h; -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------- - HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(5 rows) - -INSERT INTO chunks VALUES ('1901-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Wed Jul 31 17:00:00 1901 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=1 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(9 rows) - --- Compare prepared statement with ad-hoc query -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 -(1 row) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 -(1 row) - --- Add new chunks to the non materialized part of the CAgg -INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); -:EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=2 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=1 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=1 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(17 rows) - -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=2 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=1 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=1 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(17 rows) - -INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); -:EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=2 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=2 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(22 rows) - -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=2 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=2 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(22 rows) - --- Materialize CAgg and check for plan time chunk exclusion -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) -(14 rows) - -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) -(14 rows) - --- Check plan when chunk_append and constraint_aware_append cannot be used --- There should be no plans for scans of chunks that are materialized in the CAgg --- on the underlying hypertable -SET timescaledb.enable_chunk_append = OFF; -SET timescaledb.enable_constraint_aware_append = OFF; -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) -(14 rows) - -RESET timescaledb.enable_chunk_append; -RESET timescaledb.enable_constraint_aware_append; --- Insert new values and check watermark changes -INSERT INTO chunks VALUES ('1920-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Sat Jul 31 17:00:00 1920 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=4 loops=1) - -> Append (actual rows=4 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_22_chunk."time"), _hyper_7_22_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_22_chunk_chunks_time_idx on _hyper_7_22_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) -(16 rows) - --- Compare prepared statement with ad-hoc query -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 -(4 rows) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 -(4 rows) - -INSERT INTO chunks VALUES ('1930-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Thu Jul 31 17:00:00 1930 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=5 loops=1) - -> Append (actual rows=5 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_24_chunk."time"), _hyper_7_24_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_24_chunk_chunks_time_idx on _hyper_7_24_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) -(18 rows) - --- Two invalidations without prepared statement execution between -INSERT INTO chunks VALUES ('1931-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -INSERT INTO chunks VALUES ('1932-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Sun Jul 31 17:00:00 1932 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=7 loops=1) - -> Append (actual rows=7 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_28_chunk."time"), _hyper_7_28_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_28_chunk_chunks_time_idx on _hyper_7_28_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) -(22 rows) - --- Multiple prepared statement executions followed by one invalidation -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=7 loops=1) - -> Append (actual rows=7 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_28_chunk."time"), _hyper_7_28_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_28_chunk_chunks_time_idx on _hyper_7_28_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) -(22 rows) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=7 loops=1) - -> Append (actual rows=7 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_28_chunk."time"), _hyper_7_28_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_28_chunk_chunks_time_idx on _hyper_7_28_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) -(22 rows) - -INSERT INTO chunks VALUES ('1940-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=8 loops=1) - -> Append (actual rows=8 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_30_chunk."time"), _hyper_7_30_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_30_chunk_chunks_time_idx on _hyper_7_30_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) -(24 rows) - --- Compare prepared statement with ad-hoc query -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - --- Delete data from hypertable - data is only present in cagg after this point. If the watermark in the prepared --- statement is not moved to the most-recent watermark, we would see an empty result. -TRUNCATE chunks; -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - --- Refresh the CAgg -CALL refresh_continuous_aggregate('chunks_1h', NULL, NULL); -EXECUTE cagg_scan_1h; - bucket | device | max ---------+--------+----- -(0 rows) - -SELECT * FROM chunks_1h; - bucket | device | max ---------+--------+----- -(0 rows) - --- Check new watermark -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Wed Jul 31 17:00:00 1940 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=0 loops=1) - -> Append (actual rows=0 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(23 rows) - --- Update after truncate -INSERT INTO chunks VALUES ('1950-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Mon Jul 31 17:00:00 1950 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_32_chunk."time"), _hyper_7_32_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_32_chunk_chunks_time_idx on _hyper_7_32_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) -(26 rows) - --- Test with CAgg on CAgg -CREATE MATERIALIZED VIEW chunks_1d WITH (timescaledb.continuous, timescaledb.materialized_only = false) - AS SELECT time_bucket('1 days', bucket) AS bucket, device, max(max) AS max FROM chunks_1h GROUP BY 1, 2; -NOTICE: refreshing continuous aggregate "chunks_1d" -SELECT id AS "MAT_HT_ID_1D" FROM _timescaledb_catalog.hypertable - WHERE table_name=( - SELECT materialization_hypertable_name - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1d' - ) \gset -SELECT materialization_hypertable_schema || '.' || materialization_hypertable_name AS "MAT_HT_NAME_1D" - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1d' -\gset --- Prepared scan on hypertable (identical to the query of a real-time CAgg) -PREPARE ht_scan_realtime_1d AS - SELECT bucket, device, max - FROM :MAT_HT_NAME_1D - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1D)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1D)), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; -PREPARE cagg_scan_1d AS SELECT * FROM chunks_1d; -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1d; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=1 loops=1) - -> Index Scan using _hyper_9_34_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_34_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Tue Aug 01 16:00:00 1950 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, "time"))), device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(12 rows) - -INSERT INTO chunks VALUES ('2000-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -CALL refresh_continuous_aggregate('chunks_1d', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1d; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) - -> Index Scan using _hyper_9_34_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_34_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Tue Aug 01 17:00:00 2000 PDT'::timestamp with time zone) - -> Index Scan using _hyper_9_37_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_37_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Tue Aug 01 17:00:00 2000 PDT'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, "time"))), device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(15 rows) - -INSERT INTO chunks VALUES ('2010-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -CALL refresh_continuous_aggregate('chunks_1d', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1d; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_9_34_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_34_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Aug 01 17:00:00 2010 PDT'::timestamp with time zone) - -> Index Scan using _hyper_9_37_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_37_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Aug 01 17:00:00 2010 PDT'::timestamp with time zone) - -> Index Scan using _hyper_9_40_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_40_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Aug 01 17:00:00 2010 PDT'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, "time"))), device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(17 rows) - --- Stored procedure - watermark -CREATE FUNCTION cur_watermark_plsql(mat_table int) RETURNS timestamptz -AS $$ -DECLARE -cur_watermark_value timestamptz; -BEGIN - SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(mat_table)) INTO cur_watermark_value; - RETURN cur_watermark_value; -END$$ LANGUAGE plpgsql; -SELECT * FROM cur_watermark_plsql(:MAT_HT_ID_1H); - cur_watermark_plsql ------------------------------- - Sat Jul 31 18:00:00 2010 PDT -(1 row) - -INSERT INTO chunks VALUES ('2011-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM cur_watermark_plsql(:MAT_HT_ID_1H); - cur_watermark_plsql ------------------------------- - Sun Jul 31 18:00:00 2011 PDT -(1 row) - -INSERT INTO chunks VALUES ('2012-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM cur_watermark_plsql(:MAT_HT_ID_1H); - cur_watermark_plsql ------------------------------- - Tue Jul 31 18:00:00 2012 PDT -(1 row) - --- Stored procedure - result -CREATE FUNCTION cur_cagg_result_count() RETURNS int -AS $$ -DECLARE -count_value int; -BEGIN - SELECT count(*) FROM chunks_1h INTO count_value; - RETURN count_value; -END$$ LANGUAGE plpgsql; --- Cache function value -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 5 -(1 row) - --- Add to non-materialized part -INSERT INTO chunks VALUES ('2013-08-01 01:01:01+01', 1, 2); -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 6 -(1 row) - --- Materialize -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 6 -(1 row) - --- Ensure all elements are materialized (i.e., watermark is moved properly) -TRUNCATE chunks; -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 6 -(1 row) - -SELECT count(*) FROM chunks_1h; - count -------- - 6 -(1 row) - --- Test watermark call directly -PREPARE watermark_query AS - SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); -SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Wed Jul 31 18:00:00 2013 PDT -(1 row) - -EXECUTE watermark_query; - to_timestamp ------------------------------- - Wed Jul 31 18:00:00 2013 PDT -(1 row) - -INSERT INTO chunks VALUES ('2013-09-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Sat Aug 31 18:00:00 2013 PDT -(1 row) - -EXECUTE watermark_query; - to_timestamp ------------------------------- - Sat Aug 31 18:00:00 2013 PDT -(1 row) - --- Disable constification of watermark values -SET timescaledb.enable_cagg_watermark_constify = OFF; -INSERT INTO chunks VALUES ('2014-01-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=2 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 1 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_49_chunk."time"), _hyper_7_49_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(45 rows) - -RESET timescaledb.enable_cagg_watermark_constify; --- Select with projection -INSERT INTO chunks VALUES ('2015-01-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE SELECT device FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Subquery Scan on "*SELECT* 1" (actual rows=3 loops=1) - -> Result (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Subquery Scan on "*SELECT* 2" (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) -(45 rows) - --- Watermark function use other tables in WHERE condition (should not be constified) -CREATE TABLE continuous_agg_test(time int, data int); -:EXPLAIN_ANALYZE (SELECT * FROM continuous_agg_test AS t1) UNION ALL (SELECT * from continuous_agg_test AS t2 WHERE COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) IS NOT NULL); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=0 loops=1) - -> Seq Scan on continuous_agg_test t1 (actual rows=0 loops=1) - -> Result (actual rows=0 loops=1) - One-Time Filter: (COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone) IS NOT NULL) - -> Seq Scan on continuous_agg_test t2 (actual rows=0 loops=1) -(5 rows) - --- Query without COALESCE - should not be optimized -:EXPLAIN_ANALYZE (SELECT * FROM chunks_1h AS t1) UNION ALL (SELECT * from chunks_1h AS t2 WHERE _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)) IS NOT NULL); - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Append (actual rows=3 loops=1) - -> Result (actual rows=3 loops=1) - One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 _materialized_hypertable_8_1 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk _hyper_8_17_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk _hyper_8_20_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk _hyper_8_21_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk _hyper_8_23_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk _hyper_8_25_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk _hyper_8_27_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk _hyper_8_29_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk _hyper_8_31_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk _hyper_8_33_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk _hyper_8_36_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk _hyper_8_39_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk _hyper_8_42_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk _hyper_8_44_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk _hyper_8_46_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk _hyper_8_48_chunk_1 (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk _hyper_8_50_chunk_1 (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Result (actual rows=0 loops=1) - One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks_1."time")), chunks_1.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk_1."time"), _hyper_7_51_chunk_1.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(98 rows) - --- Aggregation query over CAgg should be constified -:EXPLAIN_ANALYZE SELECT max(device) from chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ - Aggregate (actual rows=1 loops=1) - -> Append (actual rows=3 loops=1) - -> Subquery Scan on "*SELECT* 1" (actual rows=3 loops=1) - -> Result (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Subquery Scan on "*SELECT* 2" (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) -(46 rows) - --- Test with integer partitioning -CREATE TABLE integer_ht(time int, data int); -SELECT create_hypertable('integer_ht', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable --------------------------- - (10,public,integer_ht,t) -(1 row) - -CREATE FUNCTION integer_now_integer_ht() RETURNS INTEGER LANGUAGE SQL STABLE AS $$ SELECT coalesce(max(time), 0) FROM integer_ht $$; -SELECT set_integer_now_func('integer_ht', 'integer_now_integer_ht'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO integer_ht SELECT i, i FROM generate_series(0, 25) AS i; -CREATE MATERIALIZED VIEW integer_ht_cagg - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM integer_ht - GROUP BY 1; -NOTICE: refreshing continuous aggregate "integer_ht_cagg" -SELECT * FROM integer_ht_cagg; - time_bucket | count --------------+------- - 25 | 1 - 20 | 5 - 15 | 5 - 10 | 5 - 5 | 5 - 0 | 5 -(6 rows) - -:EXPLAIN_ANALYZE SELECT * FROM integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Index Scan using _hyper_11_56_chunk__materialized_hypertable_11_time_bucket_idx on _hyper_11_56_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < 30) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket(5, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(8 rows) - --- Test with big integer partitioning -CREATE TABLE big_integer_ht(time bigint, data bigint); -SELECT create_hypertable('big_integer_ht', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ------------------------------- - (12,public,big_integer_ht,t) -(1 row) - -CREATE FUNCTION integer_now_big_integer_ht() RETURNS BIGINT LANGUAGE SQL STABLE AS $$ SELECT coalesce(max(time), 0) FROM big_integer_ht $$; -SELECT set_integer_now_func('big_integer_ht', 'integer_now_big_integer_ht'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO big_integer_ht SELECT i, i FROM generate_series(0, 25) AS i; -CREATE MATERIALIZED VIEW big_integer_ht_cagg - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM big_integer_ht - GROUP BY 1; -NOTICE: refreshing continuous aggregate "big_integer_ht_cagg" -SELECT * FROM big_integer_ht_cagg; - time_bucket | count --------------+------- - 25 | 1 - 20 | 5 - 15 | 5 - 10 | 5 - 5 | 5 - 0 | 5 -(6 rows) - -:EXPLAIN_ANALYZE SELECT * FROM big_integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Index Scan using _hyper_13_60_chunk__materialized_hypertable_13_time_bucket_idx on _hyper_13_60_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < '30'::bigint) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(8 rows) - --- Test with small integer partitioning -CREATE TABLE small_integer_ht(time bigint, data bigint); -SELECT create_hypertable('small_integer_ht', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable --------------------------------- - (14,public,small_integer_ht,t) -(1 row) - -CREATE FUNCTION integer_now_small_integer_ht() RETURNS BIGINT LANGUAGE SQL STABLE AS $$ SELECT coalesce(max(time), 0) FROM small_integer_ht $$; -SELECT set_integer_now_func('small_integer_ht', 'integer_now_small_integer_ht'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO small_integer_ht SELECT i, i FROM generate_series(0, 25) AS i; -CREATE MATERIALIZED VIEW small_integer_ht_cagg - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM small_integer_ht - GROUP BY 1; -NOTICE: refreshing continuous aggregate "small_integer_ht_cagg" -SELECT * FROM small_integer_ht_cagg; - time_bucket | count --------------+------- - 25 | 1 - 20 | 5 - 15 | 5 - 10 | 5 - 5 | 5 - 0 | 5 -(6 rows) - -:EXPLAIN_ANALYZE SELECT * FROM small_integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Index Scan using _hyper_15_64_chunk__materialized_hypertable_15_time_bucket_idx on _hyper_15_64_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < '30'::bigint) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(8 rows) - --- Test handling of multiple watermark functions on integer based hypertables --- This is not a usual CAgg query. So, no constification should be done. However, --- the constification code should detect this and do nothing. -SELECT id AS "MAT_HT_ID_SMALL_INTEGER" FROM _timescaledb_catalog.hypertable - WHERE table_name=( - SELECT materialization_hypertable_name - FROM timescaledb_information.continuous_aggregates - WHERE view_name='small_integer_ht_cagg' - ) \gset -:EXPLAIN_ANALYZE SELECT time_bucket(5, time) AS time_bucket, - count(time) AS count - FROM small_integer_ht - WHERE small_integer_ht."time" >= COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) - GROUP BY (time_bucket(5, small_integer_ht."time")) -UNION ALL - SELECT time_bucket(5, time) AS time_bucket, - count(time) AS count - FROM small_integer_ht - WHERE small_integer_ht."time" < COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) - GROUP BY (time_bucket(5, small_integer_ht."time")); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=6 loops=1) - -> Finalize GroupAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('5'::bigint, small_integer_ht."time")) - -> Sort (actual rows=0 loops=1) - Sort Key: (time_bucket('5'::bigint, small_integer_ht."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) - Chunks excluded during startup: 3 - -> Finalize GroupAggregate (actual rows=6 loops=1) - Group Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) - -> Sort (actual rows=6 loops=1) - Sort Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=6 loops=1) - Chunks excluded during startup: 0 - -> Partial GroupAggregate (actual rows=2 loops=1) - Group Key: time_bucket('5'::bigint, _hyper_14_61_chunk."time") - -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Partial GroupAggregate (actual rows=2 loops=1) - Group Key: time_bucket('5'::bigint, _hyper_14_62_chunk."time") - -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Partial GroupAggregate (actual rows=2 loops=1) - Group Key: time_bucket('5'::bigint, _hyper_14_63_chunk."time") - -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 6 -(30 rows) - --- test with non constant value of the watermark function (should not be constified) -:EXPLAIN_ANALYZE SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(COALESCE(:MAT_HT_ID_1H, :MAT_HT_ID_1H))), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, _materialized_hypertable_8_1.bucket), _materialized_hypertable_8_1.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Append (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 _materialized_hypertable_8_1 (actual rows=0 loops=1) - Chunks excluded during startup: 16 - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) - Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(57 rows) - --- test with NULL constant value of the watermark function (should not be constified) -:EXPLAIN_ANALYZE SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(COALESCE(:MAT_HT_ID_1H, :MAT_HT_ID_1H))), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, _materialized_hypertable_8_1.bucket), _materialized_hypertable_8_1.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Append (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 _materialized_hypertable_8_1 (actual rows=0 loops=1) - Chunks excluded during startup: 16 - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) - Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(57 rows) - --- test with double COALESCE function (should be constified) -:EXPLAIN_ANALYZE SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"))), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: (("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) AND ("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) -(47 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -TRUNCATE _timescaledb_catalog.continuous_aggs_invalidation_threshold; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- Issue #6722: constify cagg_watermark using window func when querying a cagg -:EXPLAIN_ANALYZE -SELECT time_bucket, lead(count) OVER (ORDER BY time_bucket) FROM small_integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=6 loops=1) - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_15_64_chunk.time_bucket - Sort Method: quicksort - -> Append (actual rows=6 loops=1) - -> Index Scan using _hyper_15_64_chunk__materialized_hypertable_15_time_bucket_idx on _hyper_15_64_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < '30'::bigint) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(12 rows) - diff --git a/tsl/test/expected/cagg_watermark-16.out b/tsl/test/expected/cagg_watermark-16.out deleted file mode 100644 index da9a5017370..00000000000 --- a/tsl/test/expected/cagg_watermark-16.out +++ /dev/null @@ -1,1873 +0,0 @@ --- This file and its contents are licensed under the Timescale License. --- Please see the included NOTICE for copyright information and --- LICENSE-TIMESCALE for a copy of the license. -\set EXPLAIN_ANALYZE 'EXPLAIN (analyze,costs off,timing off,summary off)' -CREATE TABLE continuous_agg_test(time int, data int); -SELECT create_hypertable('continuous_agg_test', 'time', chunk_time_interval=> 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ----------------------------------- - (1,public,continuous_agg_test,t) -(1 row) - -CREATE OR REPLACE FUNCTION integer_now_test1() returns int LANGUAGE SQL STABLE as $$ SELECT coalesce(max(time), 0) FROM continuous_agg_test $$; -SELECT set_integer_now_func('continuous_agg_test', 'integer_now_test1'); - set_integer_now_func ----------------------- - -(1 row) - --- watermark tabels start out empty -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- -(0 rows) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - --- inserting into a table that does not have continuous_agg_insert_trigger doesn't change the watermark -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2), (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- -(0 rows) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -CREATE TABLE continuous_agg_test_mat(time int); -SELECT create_hypertable('continuous_agg_test_mat', 'time', chunk_time_interval=> 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable --------------------------------------- - (2,public,continuous_agg_test_mat,t) -(1 row) - -INSERT INTO _timescaledb_catalog.continuous_agg VALUES (2, 1, NULL, '', '', '', '', '', ''); -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- create the trigger -CREATE TRIGGER continuous_agg_insert_trigger - AFTER INSERT ON continuous_agg_test - FOR EACH ROW EXECUTE FUNCTION _timescaledb_functions.continuous_agg_invalidation_trigger(1); --- inserting into the table still doesn't change the watermark since there's no --- continuous_aggs_invalidation_threshold. We treat that case as a invalidation_watermark of --- BIG_INT_MIN, since the first run of the aggregation will need to scan the --- entire table anyway. -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2), (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- -(0 rows) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - --- set the continuous_aggs_invalidation_threshold to 15, any insertions below that value need an invalidation -\c :TEST_DBNAME :ROLE_SUPERUSER -INSERT INTO _timescaledb_catalog.continuous_aggs_invalidation_threshold VALUES (1, 15); -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2), (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 -(1 row) - --- INSERTs only above the continuous_aggs_invalidation_threshold won't change the continuous_aggs_hypertable_invalidation_log -INSERT INTO continuous_agg_test VALUES (21, 3), (22, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 -(1 row) - --- INSERTs only below the continuous_aggs_invalidation_threshold will change the continuous_aggs_hypertable_invalidation_log -INSERT INTO continuous_agg_test VALUES (10, 1), (11, 2); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 -(2 rows) - --- test INSERTing other values -INSERT INTO continuous_agg_test VALUES (1, 7), (12, 6), (24, 5), (51, 4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 -(3 rows) - --- INSERT after dropping a COLUMN -ALTER TABLE continuous_agg_test DROP COLUMN data; -INSERT INTO continuous_agg_test VALUES (-1), (-2), (-3), (-4); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 -(4 rows) - -INSERT INTO continuous_agg_test VALUES (100); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 -(4 rows) - --- INSERT after adding a COLUMN -ALTER TABLE continuous_agg_test ADD COLUMN d BOOLEAN; -INSERT INTO continuous_agg_test VALUES (-6, true), (-7, false), (-3, true), (-4, false); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 - 1 | -7 | -3 -(5 rows) - -INSERT INTO continuous_agg_test VALUES (120, false), (200, true); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 1 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 1 | 10 | 22 - 1 | 10 | 11 - 1 | 1 | 51 - 1 | -4 | -1 - 1 | -7 | -3 -(5 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -DELETE FROM _timescaledb_catalog.continuous_agg where mat_hypertable_id = 2; -DELETE FROM _timescaledb_config.bgw_job WHERE id = 2; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -DROP TABLE continuous_agg_test CASCADE; -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -TRUNCATE _timescaledb_catalog.continuous_aggs_invalidation_threshold; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- CREATE VIEW creates the invalidation trigger correctly -CREATE TABLE ca_inval_test(time int); -SELECT create_hypertable('ca_inval_test', 'time', chunk_time_interval=> 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ----------------------------- - (3,public,ca_inval_test,t) -(1 row) - -CREATE OR REPLACE FUNCTION integer_now_test2() returns int LANGUAGE SQL STABLE as $$ SELECT coalesce(max(time), 0) FROM ca_inval_test $$; -SELECT set_integer_now_func('ca_inval_test', 'integer_now_test2'); - set_integer_now_func ----------------------- - -(1 row) - -CREATE MATERIALIZED VIEW cit_view - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM ca_inval_test - GROUP BY 1 WITH NO DATA; -INSERT INTO ca_inval_test SELECT generate_series(0, 5); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+------------- - 3 | -2147483648 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -UPDATE _timescaledb_catalog.continuous_aggs_invalidation_threshold -SET watermark = 15 -WHERE hypertable_id = 3; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -INSERT INTO ca_inval_test SELECT generate_series(5, 15); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 3 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 3 | 5 | 15 -(1 row) - -INSERT INTO ca_inval_test SELECT generate_series(16, 20); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 3 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 3 | 5 | 15 -(1 row) - -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- updates below the threshold update both the old and new values -UPDATE ca_inval_test SET time = 5 WHERE time = 6; -UPDATE ca_inval_test SET time = 7 WHERE time = 5; -UPDATE ca_inval_test SET time = 17 WHERE time = 14; -UPDATE ca_inval_test SET time = 12 WHERE time = 16; --- updates purely above the threshold are not logged -UPDATE ca_inval_test SET time = 19 WHERE time = 18; -UPDATE ca_inval_test SET time = 17 WHERE time = 19; -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 3 | 15 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 3 | 5 | 6 - 3 | 5 | 7 - 3 | 14 | 17 - 3 | 12 | 16 -(4 rows) - -DROP TABLE ca_inval_test CASCADE; -NOTICE: drop cascades to 3 other objects -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -TRUNCATE _timescaledb_catalog.continuous_aggs_invalidation_threshold; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- invalidation trigger is created correctly on chunks that existed before --- the view was created -CREATE TABLE ts_continuous_test(time INTEGER, location INTEGER); - SELECT create_hypertable('ts_continuous_test', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ---------------------------------- - (5,public,ts_continuous_test,t) -(1 row) - -CREATE OR REPLACE FUNCTION integer_now_test3() returns int LANGUAGE SQL STABLE as $$ SELECT coalesce(max(time), 0) FROM ts_continuous_test $$; -SELECT set_integer_now_func('ts_continuous_test', 'integer_now_test3'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO ts_continuous_test SELECT i, i FROM - (SELECT generate_series(0, 29) AS i) AS i; -CREATE MATERIALIZED VIEW continuous_view - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(location) - FROM ts_continuous_test - GROUP BY 1 WITH NO DATA; -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+------------- - 5 | -2147483648 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- -(0 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -UPDATE _timescaledb_catalog.continuous_aggs_invalidation_threshold -SET watermark = 2 -WHERE hypertable_id = 5; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER -INSERT INTO ts_continuous_test VALUES (1, 1); -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 5 | 2 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 5 | 1 | 1 -(1 row) - --- aborts don't get written -BEGIN; - INSERT INTO ts_continuous_test VALUES (-20, -20); -ABORT; -SELECT * FROM _timescaledb_catalog.continuous_aggs_invalidation_threshold; - hypertable_id | watermark ----------------+----------- - 5 | 2 -(1 row) - -SELECT * from _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; - hypertable_id | lowest_modified_value | greatest_modified_value ----------------+-----------------------+------------------------- - 5 | 1 | 1 -(1 row) - -DROP TABLE ts_continuous_test CASCADE; -NOTICE: drop cascades to 3 other objects ----- --- Test watermark invalidation and chunk exclusion with prepared and ad-hoc queries ----- -CREATE TABLE chunks(time timestamptz, device int, value float); -SELECT FROM create_hypertable('chunks','time',chunk_time_interval:='1d'::interval); -NOTICE: adding not-null constraint to column "time" --- -(1 row) - -CREATE MATERIALIZED VIEW chunks_1h WITH (timescaledb.continuous, timescaledb.materialized_only = false) - AS SELECT time_bucket('1 hour', time) AS bucket, device, max(value) AS max FROM chunks GROUP BY 1, 2; -NOTICE: continuous aggregate "chunks_1h" is already up-to-date --- Get id of the materialization hypertable -SELECT id AS "MAT_HT_ID_1H" FROM _timescaledb_catalog.hypertable - WHERE table_name=( - SELECT materialization_hypertable_name - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1h' - ) \gset -SELECT materialization_hypertable_schema || '.' || materialization_hypertable_name AS "MAT_HT_NAME_1H" - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1h' -\gset --- Prepared scan on hypertable (identical to the query of a real-time CAgg) -PREPARE ht_scan_realtime_1h AS - SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('01:00:00'::interval, chunks."time") AS bucket, - chunks.device, - max(chunks.value) AS max - FROM chunks - WHERE chunks."time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('01:00:00'::interval, chunks."time")), chunks.device; -PREPARE cagg_scan_1h AS SELECT * FROM chunks_1h; -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------- - HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, chunks."time"), chunks.device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(5 rows) - -INSERT INTO chunks VALUES ('1901-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Wed Jul 31 17:00:00 1901 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=1 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(9 rows) - --- Compare prepared statement with ad-hoc query -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 -(1 row) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 -(1 row) - --- Add new chunks to the non materialized part of the CAgg -INSERT INTO chunks VALUES ('1910-08-01 01:01:01+01', 1, 2); -:EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=2 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=1 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=1 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(17 rows) - -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=2 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=1 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=1 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(17 rows) - -INSERT INTO chunks VALUES ('1911-08-01 01:01:01+01', 1, 2); -:EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=2 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=2 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(22 rows) - -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Finalize HashAggregate (actual rows=2 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time")), _hyper_7_16_chunk.device - Batches: 1 - -> Append (actual rows=2 loops=1) - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_16_chunk."time"), _hyper_7_16_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_16_chunk_chunks_time_idx on _hyper_7_16_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_18_chunk."time"), _hyper_7_18_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_18_chunk_chunks_time_idx on _hyper_7_18_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1901 PST'::timestamp with time zone) -(22 rows) - --- Materialize CAgg and check for plan time chunk exclusion -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE cagg_scan_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) -(14 rows) - -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) -(14 rows) - --- Check plan when chunk_append and constraint_aware_append cannot be used --- There should be no plans for scans of chunks that are materialized in the CAgg --- on the underlying hypertable -SET timescaledb.enable_chunk_append = OFF; -SET timescaledb.enable_constraint_aware_append = OFF; -:EXPLAIN_ANALYZE SELECT * FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_19_chunk."time"), _hyper_7_19_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_19_chunk_chunks_time_idx on _hyper_7_19_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1911 PST'::timestamp with time zone) -(14 rows) - -RESET timescaledb.enable_chunk_append; -RESET timescaledb.enable_constraint_aware_append; --- Insert new values and check watermark changes -INSERT INTO chunks VALUES ('1920-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Sat Jul 31 17:00:00 1920 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=4 loops=1) - -> Append (actual rows=4 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_22_chunk."time"), _hyper_7_22_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_22_chunk_chunks_time_idx on _hyper_7_22_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sat Jul 31 17:00:00 1920 PST'::timestamp with time zone) -(16 rows) - --- Compare prepared statement with ad-hoc query -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 -(4 rows) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 -(4 rows) - -INSERT INTO chunks VALUES ('1930-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Thu Jul 31 17:00:00 1930 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=5 loops=1) - -> Append (actual rows=5 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_24_chunk."time"), _hyper_7_24_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_24_chunk_chunks_time_idx on _hyper_7_24_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Thu Jul 31 17:00:00 1930 PST'::timestamp with time zone) -(18 rows) - --- Two invalidations without prepared statement execution between -INSERT INTO chunks VALUES ('1931-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -INSERT INTO chunks VALUES ('1932-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Sun Jul 31 17:00:00 1932 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=7 loops=1) - -> Append (actual rows=7 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_28_chunk."time"), _hyper_7_28_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_28_chunk_chunks_time_idx on _hyper_7_28_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) -(22 rows) - --- Multiple prepared statement executions followed by one invalidation -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=7 loops=1) - -> Append (actual rows=7 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_28_chunk."time"), _hyper_7_28_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_28_chunk_chunks_time_idx on _hyper_7_28_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) -(22 rows) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=7 loops=1) - -> Append (actual rows=7 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_28_chunk."time"), _hyper_7_28_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_28_chunk_chunks_time_idx on _hyper_7_28_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Sun Jul 31 17:00:00 1932 PST'::timestamp with time zone) -(22 rows) - -INSERT INTO chunks VALUES ('1940-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=8 loops=1) - -> Append (actual rows=8 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_30_chunk."time"), _hyper_7_30_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_30_chunk_chunks_time_idx on _hyper_7_30_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) -(24 rows) - --- Compare prepared statement with ad-hoc query -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - --- Delete data from hypertable - data is only present in cagg after this point. If the watermark in the prepared --- statement is not moved to the most-recent watermark, we would see an empty result. -TRUNCATE chunks; -EXECUTE cagg_scan_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - -SELECT * FROM chunks_1h; - bucket | device | max -------------------------------+--------+----- - Wed Jul 31 16:00:00 1901 PST | 1 | 2 - Sun Jul 31 16:00:00 1910 PST | 1 | 2 - Mon Jul 31 16:00:00 1911 PST | 1 | 2 - Sat Jul 31 16:00:00 1920 PST | 1 | 2 - Thu Jul 31 16:00:00 1930 PST | 1 | 2 - Fri Jul 31 16:00:00 1931 PST | 1 | 2 - Sun Jul 31 16:00:00 1932 PST | 1 | 2 - Wed Jul 31 16:00:00 1940 PST | 1 | 2 -(8 rows) - --- Refresh the CAgg -CALL refresh_continuous_aggregate('chunks_1h', NULL, NULL); -EXECUTE cagg_scan_1h; - bucket | device | max ---------+--------+----- -(0 rows) - -SELECT * FROM chunks_1h; - bucket | device | max ---------+--------+----- -(0 rows) - --- Check new watermark -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Wed Jul 31 17:00:00 1940 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=0 loops=1) - -> Append (actual rows=0 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Jul 31 17:00:00 1940 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(23 rows) - --- Update after truncate -INSERT INTO chunks VALUES ('1950-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Mon Jul 31 17:00:00 1950 PST -(1 row) - -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=1 loops=1) - -> Append (actual rows=1 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_32_chunk."time"), _hyper_7_32_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_32_chunk_chunks_time_idx on _hyper_7_32_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Mon Jul 31 17:00:00 1950 PST'::timestamp with time zone) -(26 rows) - --- Test with CAgg on CAgg -CREATE MATERIALIZED VIEW chunks_1d WITH (timescaledb.continuous, timescaledb.materialized_only = false) - AS SELECT time_bucket('1 days', bucket) AS bucket, device, max(max) AS max FROM chunks_1h GROUP BY 1, 2; -NOTICE: refreshing continuous aggregate "chunks_1d" -SELECT id AS "MAT_HT_ID_1D" FROM _timescaledb_catalog.hypertable - WHERE table_name=( - SELECT materialization_hypertable_name - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1d' - ) \gset -SELECT materialization_hypertable_schema || '.' || materialization_hypertable_name AS "MAT_HT_NAME_1D" - FROM timescaledb_information.continuous_aggregates - WHERE view_name='chunks_1d' -\gset --- Prepared scan on hypertable (identical to the query of a real-time CAgg) -PREPARE ht_scan_realtime_1d AS - SELECT bucket, device, max - FROM :MAT_HT_NAME_1D - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1D)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1D)), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; -PREPARE cagg_scan_1d AS SELECT * FROM chunks_1d; -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1d; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=1 loops=1) - -> Index Scan using _hyper_9_34_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_34_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Tue Aug 01 16:00:00 1950 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, "time"))), device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(12 rows) - -INSERT INTO chunks VALUES ('2000-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -CALL refresh_continuous_aggregate('chunks_1d', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1d; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=2 loops=1) - -> Append (actual rows=2 loops=1) - -> Index Scan using _hyper_9_34_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_34_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Tue Aug 01 17:00:00 2000 PDT'::timestamp with time zone) - -> Index Scan using _hyper_9_37_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_37_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Tue Aug 01 17:00:00 2000 PDT'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, "time"))), device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(15 rows) - -INSERT INTO chunks VALUES ('2010-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -CALL refresh_continuous_aggregate('chunks_1d', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1d; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_9_34_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_34_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Aug 01 17:00:00 2010 PDT'::timestamp with time zone) - -> Index Scan using _hyper_9_37_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_37_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Aug 01 17:00:00 2010 PDT'::timestamp with time zone) - -> Index Scan using _hyper_9_40_chunk__materialized_hypertable_9_bucket_idx on _hyper_9_40_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Sun Aug 01 17:00:00 2010 PDT'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, "time"))), device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, "time"), device - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(17 rows) - --- Stored procedure - watermark -CREATE FUNCTION cur_watermark_plsql(mat_table int) RETURNS timestamptz -AS $$ -DECLARE -cur_watermark_value timestamptz; -BEGIN - SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(mat_table)) INTO cur_watermark_value; - RETURN cur_watermark_value; -END$$ LANGUAGE plpgsql; -SELECT * FROM cur_watermark_plsql(:MAT_HT_ID_1H); - cur_watermark_plsql ------------------------------- - Sat Jul 31 18:00:00 2010 PDT -(1 row) - -INSERT INTO chunks VALUES ('2011-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM cur_watermark_plsql(:MAT_HT_ID_1H); - cur_watermark_plsql ------------------------------- - Sun Jul 31 18:00:00 2011 PDT -(1 row) - -INSERT INTO chunks VALUES ('2012-08-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM cur_watermark_plsql(:MAT_HT_ID_1H); - cur_watermark_plsql ------------------------------- - Tue Jul 31 18:00:00 2012 PDT -(1 row) - --- Stored procedure - result -CREATE FUNCTION cur_cagg_result_count() RETURNS int -AS $$ -DECLARE -count_value int; -BEGIN - SELECT count(*) FROM chunks_1h INTO count_value; - RETURN count_value; -END$$ LANGUAGE plpgsql; --- Cache function value -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 5 -(1 row) - --- Add to non-materialized part -INSERT INTO chunks VALUES ('2013-08-01 01:01:01+01', 1, 2); -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 6 -(1 row) - --- Materialize -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 6 -(1 row) - --- Ensure all elements are materialized (i.e., watermark is moved properly) -TRUNCATE chunks; -SELECT * FROM cur_cagg_result_count(); - cur_cagg_result_count ------------------------ - 6 -(1 row) - -SELECT count(*) FROM chunks_1h; - count -------- - 6 -(1 row) - --- Test watermark call directly -PREPARE watermark_query AS - SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); -SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Wed Jul 31 18:00:00 2013 PDT -(1 row) - -EXECUTE watermark_query; - to_timestamp ------------------------------- - Wed Jul 31 18:00:00 2013 PDT -(1 row) - -INSERT INTO chunks VALUES ('2013-09-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -SELECT _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)); - to_timestamp ------------------------------- - Sat Aug 31 18:00:00 2013 PDT -(1 row) - -EXECUTE watermark_query; - to_timestamp ------------------------------- - Sat Aug 31 18:00:00 2013 PDT -(1 row) - --- Disable constification of watermark values -SET timescaledb.enable_cagg_watermark_constify = OFF; -INSERT INTO chunks VALUES ('2014-01-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE EXECUTE ht_scan_realtime_1h; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=2 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=2 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 1 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_49_chunk."time"), _hyper_7_49_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_49_chunk_chunks_time_idx on _hyper_7_49_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(45 rows) - -RESET timescaledb.enable_cagg_watermark_constify; --- Select with projection -INSERT INTO chunks VALUES ('2015-01-01 01:01:01+01', 1, 2); -CALL refresh_continuous_aggregate('chunks_1h', '1900-01-01', '2021-06-01'); -:EXPLAIN_ANALYZE SELECT device FROM chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=3 loops=1) - -> Subquery Scan on "*SELECT* 1" (actual rows=3 loops=1) - -> Result (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Subquery Scan on "*SELECT* 2" (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) -(45 rows) - --- Watermark function use other tables in WHERE condition (should not be constified) -CREATE TABLE continuous_agg_test(time int, data int); -:EXPLAIN_ANALYZE (SELECT * FROM continuous_agg_test AS t1) UNION ALL (SELECT * from continuous_agg_test AS t2 WHERE COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) IS NOT NULL); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=0 loops=1) - -> Seq Scan on continuous_agg_test t1 (actual rows=0 loops=1) - -> Result (actual rows=0 loops=1) - One-Time Filter: (COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone) IS NOT NULL) - -> Seq Scan on continuous_agg_test t2 (actual rows=0 loops=1) -(5 rows) - --- Query without COALESCE - should not be optimized -:EXPLAIN_ANALYZE (SELECT * FROM chunks_1h AS t1) UNION ALL (SELECT * from chunks_1h AS t2 WHERE _timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)) IS NOT NULL); - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Append (actual rows=3 loops=1) - -> Result (actual rows=3 loops=1) - One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 _materialized_hypertable_8_1 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk _hyper_8_17_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk _hyper_8_20_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk _hyper_8_21_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk _hyper_8_23_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk _hyper_8_25_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk _hyper_8_27_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk _hyper_8_29_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk _hyper_8_31_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk _hyper_8_33_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk _hyper_8_36_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk _hyper_8_39_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk _hyper_8_42_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk _hyper_8_44_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk _hyper_8_46_chunk_1 (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk _hyper_8_48_chunk_1 (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk _hyper_8_50_chunk_1 (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Result (actual rows=0 loops=1) - One-Time Filter: (_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)) IS NOT NULL) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks_1."time")), chunks_1.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks chunks_1 (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk_1."time"), _hyper_7_51_chunk_1.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk _hyper_7_51_chunk_1 (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(98 rows) - --- Aggregation query over CAgg should be constified -:EXPLAIN_ANALYZE SELECT max(device) from chunks_1h; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ - Aggregate (actual rows=1 loops=1) - -> Append (actual rows=3 loops=1) - -> Subquery Scan on "*SELECT* 1" (actual rows=3 loops=1) - -> Result (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Subquery Scan on "*SELECT* 2" (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) -(46 rows) - --- Test with integer partitioning -CREATE TABLE integer_ht(time int, data int); -SELECT create_hypertable('integer_ht', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable --------------------------- - (10,public,integer_ht,t) -(1 row) - -CREATE FUNCTION integer_now_integer_ht() RETURNS INTEGER LANGUAGE SQL STABLE AS $$ SELECT coalesce(max(time), 0) FROM integer_ht $$; -SELECT set_integer_now_func('integer_ht', 'integer_now_integer_ht'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO integer_ht SELECT i, i FROM generate_series(0, 25) AS i; -CREATE MATERIALIZED VIEW integer_ht_cagg - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM integer_ht - GROUP BY 1; -NOTICE: refreshing continuous aggregate "integer_ht_cagg" -SELECT * FROM integer_ht_cagg; - time_bucket | count --------------+------- - 25 | 1 - 20 | 5 - 15 | 5 - 10 | 5 - 5 | 5 - 0 | 5 -(6 rows) - -:EXPLAIN_ANALYZE SELECT * FROM integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Index Scan using _hyper_11_56_chunk__materialized_hypertable_11_time_bucket_idx on _hyper_11_56_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < 30) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket(5, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(8 rows) - --- Test with big integer partitioning -CREATE TABLE big_integer_ht(time bigint, data bigint); -SELECT create_hypertable('big_integer_ht', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable ------------------------------- - (12,public,big_integer_ht,t) -(1 row) - -CREATE FUNCTION integer_now_big_integer_ht() RETURNS BIGINT LANGUAGE SQL STABLE AS $$ SELECT coalesce(max(time), 0) FROM big_integer_ht $$; -SELECT set_integer_now_func('big_integer_ht', 'integer_now_big_integer_ht'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO big_integer_ht SELECT i, i FROM generate_series(0, 25) AS i; -CREATE MATERIALIZED VIEW big_integer_ht_cagg - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM big_integer_ht - GROUP BY 1; -NOTICE: refreshing continuous aggregate "big_integer_ht_cagg" -SELECT * FROM big_integer_ht_cagg; - time_bucket | count --------------+------- - 25 | 1 - 20 | 5 - 15 | 5 - 10 | 5 - 5 | 5 - 0 | 5 -(6 rows) - -:EXPLAIN_ANALYZE SELECT * FROM big_integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Index Scan using _hyper_13_60_chunk__materialized_hypertable_13_time_bucket_idx on _hyper_13_60_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < '30'::bigint) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(8 rows) - --- Test with small integer partitioning -CREATE TABLE small_integer_ht(time bigint, data bigint); -SELECT create_hypertable('small_integer_ht', 'time', chunk_time_interval => 10); -NOTICE: adding not-null constraint to column "time" - create_hypertable --------------------------------- - (14,public,small_integer_ht,t) -(1 row) - -CREATE FUNCTION integer_now_small_integer_ht() RETURNS BIGINT LANGUAGE SQL STABLE AS $$ SELECT coalesce(max(time), 0) FROM small_integer_ht $$; -SELECT set_integer_now_func('small_integer_ht', 'integer_now_small_integer_ht'); - set_integer_now_func ----------------------- - -(1 row) - -INSERT INTO small_integer_ht SELECT i, i FROM generate_series(0, 25) AS i; -CREATE MATERIALIZED VIEW small_integer_ht_cagg - WITH (timescaledb.continuous, timescaledb.materialized_only=false) - AS SELECT time_bucket('5', time), COUNT(time) - FROM small_integer_ht - GROUP BY 1; -NOTICE: refreshing continuous aggregate "small_integer_ht_cagg" -SELECT * FROM small_integer_ht_cagg; - time_bucket | count --------------+------- - 25 | 1 - 20 | 5 - 15 | 5 - 10 | 5 - 5 | 5 - 0 | 5 -(6 rows) - -:EXPLAIN_ANALYZE SELECT * FROM small_integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=6 loops=1) - -> Index Scan using _hyper_15_64_chunk__materialized_hypertable_15_time_bucket_idx on _hyper_15_64_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < '30'::bigint) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(8 rows) - --- Test handling of multiple watermark functions on integer based hypertables --- This is not a usual CAgg query. So, no constification should be done. However, --- the constification code should detect this and do nothing. -SELECT id AS "MAT_HT_ID_SMALL_INTEGER" FROM _timescaledb_catalog.hypertable - WHERE table_name=( - SELECT materialization_hypertable_name - FROM timescaledb_information.continuous_aggregates - WHERE view_name='small_integer_ht_cagg' - ) \gset -:EXPLAIN_ANALYZE SELECT time_bucket(5, time) AS time_bucket, - count(time) AS count - FROM small_integer_ht - WHERE small_integer_ht."time" >= COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) - GROUP BY (time_bucket(5, small_integer_ht."time")) -UNION ALL - SELECT time_bucket(5, time) AS time_bucket, - count(time) AS count - FROM small_integer_ht - WHERE small_integer_ht."time" < COALESCE(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer, _timescaledb_functions.cagg_watermark(:MAT_HT_ID_SMALL_INTEGER)::integer) - GROUP BY (time_bucket(5, small_integer_ht."time")); - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - Append (actual rows=6 loops=1) - -> Finalize GroupAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('5'::bigint, small_integer_ht."time")) - -> Sort (actual rows=0 loops=1) - Sort Key: (time_bucket('5'::bigint, small_integer_ht."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on small_integer_ht (actual rows=0 loops=1) - Chunks excluded during startup: 3 - -> Finalize GroupAggregate (actual rows=6 loops=1) - Group Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) - -> Sort (actual rows=6 loops=1) - Sort Key: (time_bucket('5'::bigint, small_integer_ht_1."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on small_integer_ht small_integer_ht_1 (actual rows=6 loops=1) - Chunks excluded during startup: 0 - -> Partial GroupAggregate (actual rows=2 loops=1) - Group Key: time_bucket('5'::bigint, _hyper_14_61_chunk."time") - -> Index Only Scan Backward using _hyper_14_61_chunk_small_integer_ht_time_idx on _hyper_14_61_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Partial GroupAggregate (actual rows=2 loops=1) - Group Key: time_bucket('5'::bigint, _hyper_14_62_chunk."time") - -> Index Only Scan Backward using _hyper_14_62_chunk_small_integer_ht_time_idx on _hyper_14_62_chunk (actual rows=10 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 10 - -> Partial GroupAggregate (actual rows=2 loops=1) - Group Key: time_bucket('5'::bigint, _hyper_14_63_chunk."time") - -> Index Only Scan Backward using _hyper_14_63_chunk_small_integer_ht_time_idx on _hyper_14_63_chunk (actual rows=6 loops=1) - Index Cond: ("time" < COALESCE((_timescaledb_functions.cagg_watermark(15))::integer, (_timescaledb_functions.cagg_watermark(15))::integer)) - Heap Fetches: 6 -(30 rows) - --- test with non constant value of the watermark function (should not be constified) -:EXPLAIN_ANALYZE SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(COALESCE(:MAT_HT_ID_1H, :MAT_HT_ID_1H))), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, _materialized_hypertable_8_1.bucket), _materialized_hypertable_8_1.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Append (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 _materialized_hypertable_8_1 (actual rows=0 loops=1) - Chunks excluded during startup: 16 - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) - Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(57 rows) - --- test with NULL constant value of the watermark function (should not be constified) -:EXPLAIN_ANALYZE SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(COALESCE(:MAT_HT_ID_1H, :MAT_HT_ID_1H))), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=3 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, _materialized_hypertable_8_1.bucket), _materialized_hypertable_8_1.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Append (actual rows=0 loops=1) - -> Custom Scan (ChunkAppend) on _materialized_hypertable_8 _materialized_hypertable_8_1 (actual rows=0 loops=1) - Chunks excluded during startup: 16 - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk _hyper_8_52_chunk_1 (actual rows=0 loops=1) - Index Cond: ((bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) AND (bucket >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone))) - -> Finalize HashAggregate (actual rows=0 loops=1) - Group Key: (time_bucket('@ 1 hour'::interval, chunks."time")), chunks.device - Batches: 1 - -> Custom Scan (ChunkAppend) on chunks (actual rows=0 loops=1) - Chunks excluded during startup: 2 - -> Partial HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: ("time" >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(8)), '-infinity'::timestamp with time zone)) -(57 rows) - --- test with double COALESCE function (should be constified) -:EXPLAIN_ANALYZE SELECT bucket, device, max - FROM :MAT_HT_NAME_1H - WHERE bucket < COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone) -UNION ALL - SELECT time_bucket('@ 1 day'::interval, chunks_1h.bucket) AS bucket, - chunks_1h.device, - max(chunks_1h.max) AS max - FROM chunks_1h - WHERE chunks_1h.bucket >= COALESCE(COALESCE(_timescaledb_functions.to_timestamp(_timescaledb_functions.cagg_watermark(:MAT_HT_ID_1H)), '-infinity'::timestamp with time zone), '-infinity'::timestamp with time zone) - GROUP BY (time_bucket('@ 1 day'::interval, chunks_1h.bucket)), chunks_1h.device; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Append (actual rows=3 loops=1) - -> Append (actual rows=3 loops=1) - -> Index Scan using _hyper_8_17_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_17_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_20_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_20_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_21_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_21_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_23_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_23_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_25_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_25_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_27_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_27_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_29_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_29_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_31_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_31_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_33_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_33_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_36_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_36_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_39_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_39_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_42_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_42_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_44_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_44_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_46_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_46_chunk (actual rows=0 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_48_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_48_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_50_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_50_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> Index Scan using _hyper_8_52_chunk__materialized_hypertable_8_bucket_idx on _hyper_8_52_chunk (actual rows=1 loops=1) - Index Cond: (bucket < 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 day'::interval, (time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"))), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('@ 1 hour'::interval, _hyper_7_51_chunk."time"), _hyper_7_51_chunk.device - Batches: 1 - -> Result (actual rows=0 loops=1) - -> Index Scan using _hyper_7_51_chunk_chunks_time_idx on _hyper_7_51_chunk (actual rows=0 loops=1) - Index Cond: (("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) AND ("time" >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone)) - Filter: (time_bucket('@ 1 hour'::interval, "time") >= 'Wed Dec 31 17:00:00 2014 PST'::timestamp with time zone) -(47 rows) - -\c :TEST_DBNAME :ROLE_SUPERUSER -TRUNCATE _timescaledb_catalog.continuous_aggs_hypertable_invalidation_log; -TRUNCATE _timescaledb_catalog.continuous_aggs_invalidation_threshold; -\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER --- Issue #6722: constify cagg_watermark using window func when querying a cagg -:EXPLAIN_ANALYZE -SELECT time_bucket, lead(count) OVER (ORDER BY time_bucket) FROM small_integer_ht_cagg; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=6 loops=1) - -> Sort (actual rows=6 loops=1) - Sort Key: _hyper_15_64_chunk.time_bucket - Sort Method: quicksort - -> Append (actual rows=6 loops=1) - -> Index Scan using _hyper_15_64_chunk__materialized_hypertable_15_time_bucket_idx on _hyper_15_64_chunk (actual rows=6 loops=1) - Index Cond: (time_bucket < '30'::bigint) - -> HashAggregate (actual rows=0 loops=1) - Group Key: time_bucket('5'::bigint, "time") - Batches: 1 - -> Result (actual rows=0 loops=1) - One-Time Filter: false -(12 rows) - diff --git a/tsl/test/expected/cagg_watermark-14.out b/tsl/test/expected/cagg_watermark.out similarity index 100% rename from tsl/test/expected/cagg_watermark-14.out rename to tsl/test/expected/cagg_watermark.out diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index 2841c98ff10..85f9bd58fdb 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -14,6 +14,7 @@ set(TEST_FILES cagg_query.sql cagg_refresh.sql cagg_utils.sql + cagg_watermark.sql compress_auto_sparse_index.sql compress_default.sql compress_dml_copy.sql @@ -138,7 +139,6 @@ set(SOLO_TESTS telemetry_stats) set(TEST_TEMPLATES - cagg_watermark.sql.in compression_sorted_merge.sql.in cagg_union_view.sql.in plan_skip_scan.sql.in diff --git a/tsl/test/sql/cagg_watermark.sql.in b/tsl/test/sql/cagg_watermark.sql similarity index 100% rename from tsl/test/sql/cagg_watermark.sql.in rename to tsl/test/sql/cagg_watermark.sql From bda8e9b7d76a847b7fb5a9753809db1e8d0d8ac8 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:52:17 +0200 Subject: [PATCH 091/157] benchmark partitionwise projection (2024-06-27 no. 1) From b856e45ced2d6c7235fa808026c031e424f37d32 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 27 Jun 2024 22:25:08 +0200 Subject: [PATCH 092/157] ref? --- .../transparent_decompression_queries.out | 13 +- .../cagg_watermark_concurrent_update_1.out | 152 ++++++++++-------- 2 files changed, 90 insertions(+), 75 deletions(-) diff --git a/tsl/test/expected/transparent_decompression_queries.out b/tsl/test/expected/transparent_decompression_queries.out index 692be4f00ff..ce938946b52 100644 --- a/tsl/test/expected/transparent_decompression_queries.out +++ b/tsl/test/expected/transparent_decompression_queries.out @@ -82,8 +82,8 @@ EXPLAIN (analyze,costs off,timing off,summary off) SELECT FROM merge_sort WHERE time < now() GROUP BY 2, 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=1 loops=1) Group Key: merge_sort.device_id, merge_sort.measure_id -> Sort (actual rows=5 loops=1) @@ -93,10 +93,9 @@ GROUP BY 2, 3; Chunks excluded during startup: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_3_5_chunk.device_id, _hyper_3_5_chunk.measure_id - -> Result (actual rows=120 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_3_5_chunk (actual rows=120 loops=1) - Vectorized Filter: ("time" < "timestamp"(now())) - -> 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) + -> Custom Scan (DecompressChunk) on _hyper_3_5_chunk (actual rows=120 loops=1) + Vectorized Filter: ("time" < "timestamp"(now())) + -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id -> Sort (actual rows=168 loops=1) @@ -125,7 +124,7 @@ GROUP BY 2, 3; Sort Method: quicksort -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) Filter: ("time" < now()) -(41 rows) +(40 rows) -- this should exclude the decompressed chunk EXPLAIN (analyze,costs off,timing off,summary off) SELECT diff --git a/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out b/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out index e16c0356a2a..05e23edd35c 100644 --- a/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out +++ b/tsl/test/isolation/expected/cagg_watermark_concurrent_update_1.out @@ -18,23 +18,27 @@ debug_waitpoint_enable step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Sort - Sort Key: _hyper_X_X_chunk.time_bucket - -> Seq Scan on _hyper_X_X_chunk - Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(14 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(18 rows) step s1_run_update: CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); @@ -42,23 +46,27 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Sort - Sort Key: _hyper_X_X_chunk.time_bucket - -> Seq Scan on _hyper_X_X_chunk - Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(14 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(18 rows) step s3_release_invalidation: SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); @@ -124,23 +132,27 @@ debug_waitpoint_enable step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Sort - Sort Key: _hyper_X_X_chunk.time_bucket - -> Seq Scan on _hyper_X_X_chunk - Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(14 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(18 rows) step s1_run_update: CALL refresh_continuous_aggregate('cagg', '2020-01-01 00:00:00', '2021-01-01 00:00:00'); @@ -148,23 +160,27 @@ step s1_run_update: step s2_select: EXPLAIN (COSTS OFF) EXECUTE pstmt; -QUERY PLAN ------------------------------------------------------------------------------------------------------ -Merge Append - Sort Key: _hyper_X_X_chunk.time_bucket - -> Sort - Sort Key: _hyper_X_X_chunk.time_bucket - -> Seq Scan on _hyper_X_X_chunk - Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> GroupAggregate - Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) - -> Custom Scan (ChunkAppend) on temperature - Order: time_bucket('@ 4 hours'::interval, temperature."time") - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) - -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk - Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) -(14 rows) +QUERY PLAN +----------------------------------------------------------------------------------------------------------- +Merge Append + Sort Key: _hyper_X_X_chunk.time_bucket + -> Sort + Sort Key: _hyper_X_X_chunk.time_bucket + -> Seq Scan on _hyper_X_X_chunk + Filter: (time_bucket < 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Finalize GroupAggregate + Group Key: (time_bucket('@ 4 hours'::interval, temperature."time")) + -> Custom Scan (ChunkAppend) on temperature + Order: time_bucket('@ 4 hours'::interval, temperature."time") + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 4 hours'::interval, _hyper_X_X_chunk."time") + -> Index Scan Backward using _hyper_X_X_chunk_temperature_time_idx on _hyper_X_X_chunk + Index Cond: ("time" >= 'Sat Jan 01 16:00:00 2000 PST'::timestamp with time zone) +(18 rows) step s3_release_invalidation: SELECT debug_waitpoint_release('cagg_watermark_update_internal_before_refresh'); From 52825e91d3999b7bbf3db899b29bd38b5895040c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Sun, 7 Jul 2024 12:19:31 +0200 Subject: [PATCH 093/157] refs --- .../expected/transparent_decompression_queries.out | 13 +++++++------ tsl/test/sql/CMakeLists.txt | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tsl/test/expected/transparent_decompression_queries.out b/tsl/test/expected/transparent_decompression_queries.out index ce938946b52..692be4f00ff 100644 --- a/tsl/test/expected/transparent_decompression_queries.out +++ b/tsl/test/expected/transparent_decompression_queries.out @@ -82,8 +82,8 @@ EXPLAIN (analyze,costs off,timing off,summary off) SELECT FROM merge_sort WHERE time < now() GROUP BY 2, 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=1 loops=1) Group Key: merge_sort.device_id, merge_sort.measure_id -> Sort (actual rows=5 loops=1) @@ -93,9 +93,10 @@ GROUP BY 2, 3; Chunks excluded during startup: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group 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) - Vectorized Filter: ("time" < "timestamp"(now())) - -> 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) + -> Result (actual rows=120 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_3_5_chunk (actual rows=120 loops=1) + Vectorized Filter: ("time" < "timestamp"(now())) + -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id -> Sort (actual rows=168 loops=1) @@ -124,7 +125,7 @@ GROUP BY 2, 3; Sort Method: quicksort -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) Filter: ("time" < now()) -(40 rows) +(41 rows) -- this should exclude the decompressed chunk EXPLAIN (analyze,costs off,timing off,summary off) SELECT diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index 85f9bd58fdb..6326e03449d 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -41,8 +41,7 @@ set(TEST_FILES skip_scan.sql transparent_decompression_join_index.sql vector_agg_default.sql - vector_agg_param.sql - vectorized_aggregation.sql) + vector_agg_param.sql) if(USE_TELEMETRY) list(APPEND TEST_FILES bgw_telemetry.sql) @@ -149,6 +148,9 @@ set(TEST_TEMPLATES # This test runs only with PG version >= 14 if((${PG_VERSION_MAJOR} GREATER_EQUAL "14")) set(TEST_FILES_ON_VERSION_GE_14 modify_exclusion.sql.in) + # This is a test for a prototype feature that has different outputs on PG14, + # so we disable it not to have to work with multiple references. + list(APPEND TEST_FILES vectorized_aggregation.sql) endif() if(CMAKE_BUILD_TYPE MATCHES Debug) From e7d187db334bce406ea33e722c358839244117b4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:17:28 +0200 Subject: [PATCH 094/157] disable on v14 --- tsl/test/sql/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tsl/test/sql/CMakeLists.txt b/tsl/test/sql/CMakeLists.txt index 6326e03449d..ba7de85508c 100644 --- a/tsl/test/sql/CMakeLists.txt +++ b/tsl/test/sql/CMakeLists.txt @@ -148,8 +148,11 @@ set(TEST_TEMPLATES # This test runs only with PG version >= 14 if((${PG_VERSION_MAJOR} GREATER_EQUAL "14")) set(TEST_FILES_ON_VERSION_GE_14 modify_exclusion.sql.in) +endif() + +if((${PG_VERSION_MAJOR} GREATER "14")) # This is a test for a prototype feature that has different outputs on PG14, - # so we disable it not to have to work with multiple references. + # so we disable it on v14 not to have to work with multiple references. list(APPEND TEST_FILES vectorized_aggregation.sql) endif() From e87fb2a57662f3db1d36153c41d740a8eb4e2957 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 23 Jul 2024 07:39:12 +0200 Subject: [PATCH 095/157] test --- .../transparent_decompression_queries.out | 147 ++++++++---------- .../sql/transparent_decompression_queries.sql | 8 +- 2 files changed, 70 insertions(+), 85 deletions(-) diff --git a/tsl/test/expected/transparent_decompression_queries.out b/tsl/test/expected/transparent_decompression_queries.out index 692be4f00ff..a9da65871f3 100644 --- a/tsl/test/expected/transparent_decompression_queries.out +++ b/tsl/test/expected/transparent_decompression_queries.out @@ -55,6 +55,7 @@ select * from test_chartab order by mac_id , ts limit 2; -- test constraintawareappend sort node handling SET enable_hashagg TO false; +SET timescaledb.enable_chunkwise_aggregation TO false; CREATE TABLE public.merge_sort (time timestamp NOT NULL, measure_id integer NOT NULL, device_id integer NOT NULL, value float); SELECT create_hypertable('merge_sort', 'time'); WARNING: column type "timestamp without time zone" used for "time" does not follow best practices @@ -65,7 +66,6 @@ WARNING: column type "timestamp without time zone" used for "time" does not fol ALTER TABLE merge_sort SET (timescaledb.compress = true, timescaledb.compress_orderby = 'time', timescaledb.compress_segmentby = 'device_id, measure_id'); INSERT INTO merge_sort SELECT time, 1, 1, extract(epoch from time) * 0.001 FROM generate_series('2000-01-01'::timestamp,'2000-02-01'::timestamp,'1h'::interval) g1(time); -ANALYZE merge_sort; --compress first chunk SELECT compress_chunk(ch) FROM show_chunks('merge_sort') ch LIMIT 1; compress_chunk @@ -73,6 +73,7 @@ SELECT compress_chunk(ch) FROM show_chunks('merge_sort') ch LIMIT 1; _timescaledb_internal._hyper_3_5_chunk (1 row) +VACUUM ANALYZE merge_sort; -- this should have a MergeAppend with children wrapped in Sort nodes EXPLAIN (analyze,costs off,timing off,summary off) SELECT last(time, time) as time, @@ -82,50 +83,39 @@ EXPLAIN (analyze,costs off,timing off,summary off) SELECT FROM merge_sort WHERE time < now() GROUP BY 2, 3; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=1 loops=1) + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- + GroupAggregate (actual rows=1 loops=1) Group Key: merge_sort.device_id, merge_sort.measure_id - -> Sort (actual rows=5 loops=1) - Sort Key: merge_sort.device_id, merge_sort.measure_id - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on merge_sort (actual rows=5 loops=1) - Chunks excluded during startup: 0 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_5_chunk.device_id, _hyper_3_5_chunk.measure_id - -> Result (actual rows=120 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_3_5_chunk (actual rows=120 loops=1) - Vectorized Filter: ("time" < "timestamp"(now())) - -> 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_6_chunk (actual rows=168 loops=1) - Filter: ("time" < now()) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) - Filter: ("time" < now()) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) - Filter: ("time" < now()) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id - -> Sort (actual rows=121 loops=1) - Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) - Filter: ("time" < now()) -(41 rows) + -> Custom Scan (ConstraintAwareAppend) (actual rows=745 loops=1) + Hypertable: merge_sort + Chunks excluded during startup: 0 + -> Merge Append (actual rows=745 loops=1) + 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) + Vectorized Filter: ("time" < "timestamp"(now())) + -> 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 + -> Seq Scan on _hyper_3_6_chunk (actual rows=168 loops=1) + Filter: ("time" < now()) + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) + Filter: ("time" < now()) + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) + Filter: ("time" < now()) + -> Sort (actual rows=121 loops=1) + Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) + Filter: ("time" < now()) +(30 rows) -- this should exclude the decompressed chunk EXPLAIN (analyze,costs off,timing off,summary off) SELECT @@ -136,46 +126,39 @@ EXPLAIN (analyze,costs off,timing off,summary off) SELECT FROM merge_sort WHERE time > '2000-01-10'::text::timestamp GROUP BY 2, 3; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=1 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------- + GroupAggregate (actual rows=1 loops=1) Group Key: merge_sort.device_id, merge_sort.measure_id - -> Sort (actual rows=4 loops=1) - Sort Key: merge_sort.device_id, merge_sort.measure_id - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on merge_sort (actual rows=4 loops=1) - Chunks excluded during startup: 1 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id - -> Sort (actual rows=71 loops=1) - Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id - Sort Method: quicksort - -> Index Scan using _hyper_3_6_chunk_merge_sort_time_idx on _hyper_3_6_chunk (actual rows=71 loops=1) - Index Cond: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) - Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id - -> Sort (actual rows=168 loops=1) - Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) - Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id - -> Sort (actual rows=121 loops=1) - Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id - Sort Method: quicksort - -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) - Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) -(35 rows) + -> Custom Scan (ConstraintAwareAppend) (actual rows=528 loops=1) + Hypertable: merge_sort + Chunks excluded during startup: 1 + -> Merge Append (actual rows=528 loops=1) + Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id + -> Sort (actual rows=71 loops=1) + Sort Key: _hyper_3_6_chunk.device_id, _hyper_3_6_chunk.measure_id + Sort Method: quicksort + -> Index Scan using _hyper_3_6_chunk_merge_sort_time_idx on _hyper_3_6_chunk (actual rows=71 loops=1) + Index Cond: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_7_chunk.device_id, _hyper_3_7_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_7_chunk (actual rows=168 loops=1) + Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) + -> Sort (actual rows=168 loops=1) + Sort Key: _hyper_3_8_chunk.device_id, _hyper_3_8_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_8_chunk (actual rows=168 loops=1) + Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) + -> Sort (actual rows=121 loops=1) + Sort Key: _hyper_3_9_chunk.device_id, _hyper_3_9_chunk.measure_id + Sort Method: quicksort + -> Seq Scan on _hyper_3_9_chunk (actual rows=121 loops=1) + Filter: ("time" > ('2000-01-10'::cstring)::timestamp without time zone) +(27 rows) RESET enable_hashagg; +RESET timescaledb.enable_chunkwise_aggregation; -- test if volatile function quals are applied to compressed chunks CREATE FUNCTION check_equal_228( intval INTEGER) RETURNS BOOL LANGUAGE PLPGSQL AS @@ -289,7 +272,7 @@ SELECT compress_chunk(ch) FROM show_chunks('options_data', older_than=> '2023-12 _timescaledb_internal._hyper_7_16_chunk (4 rows) -ANALYZE options_data; +VACUUM ANALYZE options_data; SELECT max(date) AS date FROM options_data WHERE contract_code='CONTRACT2023-12-03 04:00:00+01'; date ------ diff --git a/tsl/test/sql/transparent_decompression_queries.sql b/tsl/test/sql/transparent_decompression_queries.sql index ca9a2ddc360..042815ae63f 100644 --- a/tsl/test/sql/transparent_decompression_queries.sql +++ b/tsl/test/sql/transparent_decompression_queries.sql @@ -28,6 +28,7 @@ select * from test_chartab order by mac_id , ts limit 2; -- test constraintawareappend sort node handling SET enable_hashagg TO false; +SET timescaledb.enable_chunkwise_aggregation TO false; CREATE TABLE public.merge_sort (time timestamp NOT NULL, measure_id integer NOT NULL, device_id integer NOT NULL, value float); SELECT create_hypertable('merge_sort', 'time'); @@ -35,11 +36,11 @@ ALTER TABLE merge_sort SET (timescaledb.compress = true, timescaledb.compress_or INSERT INTO merge_sort SELECT time, 1, 1, extract(epoch from time) * 0.001 FROM generate_series('2000-01-01'::timestamp,'2000-02-01'::timestamp,'1h'::interval) g1(time); -ANALYZE merge_sort; - --compress first chunk SELECT compress_chunk(ch) FROM show_chunks('merge_sort') ch LIMIT 1; +VACUUM ANALYZE merge_sort; + -- this should have a MergeAppend with children wrapped in Sort nodes EXPLAIN (analyze,costs off,timing off,summary off) SELECT last(time, time) as time, @@ -61,6 +62,7 @@ WHERE time > '2000-01-10'::text::timestamp GROUP BY 2, 3; RESET enable_hashagg; +RESET timescaledb.enable_chunkwise_aggregation; -- test if volatile function quals are applied to compressed chunks CREATE FUNCTION check_equal_228( intval INTEGER) RETURNS BOOL @@ -133,7 +135,7 @@ ALTER TABLE options_data SET (timescaledb.compress, SELECT compress_chunk(ch) FROM show_chunks('options_data', older_than=> '2023-12-05') ch; -ANALYZE options_data; +VACUUM ANALYZE options_data; SELECT max(date) AS date FROM options_data WHERE contract_code='CONTRACT2023-12-03 04:00:00+01'; From bb37597d020a2ed86a582fde59d662826a75e387 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:34:21 +0200 Subject: [PATCH 096/157] oops --- tsl/src/chunkwise_agg.c | 86 +++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index 8395b97ab39..920aeb8d1c2 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -78,6 +78,10 @@ get_subpaths_from_append_path(Path *path, bool handle_gather_path) { return get_subpaths_from_append_path(castNode(GatherPath, path)->subpath, false); } + else if (IsA(path, ProjectionPath)) + { + return get_subpaths_from_append_path(castNode(ProjectionPath, path)->subpath, false); + } /* Aggregation push-down is not supported for other path types so far */ return NIL; @@ -142,6 +146,17 @@ copy_append_like_path(PlannerInfo *root, Path *path, List *new_subpaths, PathTar ts_chunk_append_path_copy(chunk_append_path, new_subpaths, pathtarget); return &new_chunk_append_path->cpath.path; } + else if (IsA(path, ProjectionPath)) + { + /* + * Projection goes under partial aggregation, so here we can just ignore + * it. + */ + return copy_append_like_path(root, + castNode(ProjectionPath, path)->subpath, + new_subpaths, + pathtarget); + } /* Should never happen, already checked by caller */ Ensure(false, "unknown path type"); @@ -216,33 +231,58 @@ create_hashed_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target * Add partially aggregated subpath */ static void -add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, +add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, PathTarget *partial_grouping_target, double d_num_groups, GroupPathExtraData *extra_data, bool can_sort, bool can_hash, Path *subpath, List **sorted_paths, List **hashed_paths) { /* Translate targetlist for partition */ AppendRelInfo *appinfo = ts_get_appendrelinfo(root, subpath->parent->relid, false); - PathTarget *chunktarget = copy_pathtarget(partial_grouping_target); - chunktarget->exprs = - castNode(List, adjust_appendrel_attrs(root, (Node *) chunktarget->exprs, 1, &appinfo)); + PathTarget *chunk_grouped_target = copy_pathtarget(partial_grouping_target); + chunk_grouped_target->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_grouped_target->exprs, + /* nappinfos = */ 1, + &appinfo)); - /* In declarative partitioning planning, this is done by appy_scanjoin_target_to_path */ - Assert(list_length(subpath->pathtarget->exprs) == list_length(parent_path->pathtarget->exprs)); - subpath->pathtarget->sortgrouprefs = parent_path->pathtarget->sortgrouprefs; + /* + * We might have to project before aggregation. In declarative partitioning + * planning, the projection is applied by apply_scanjoin_target_to_path(). + */ + PathTarget *chunk_target_before_grouping = copy_pathtarget(input_target); + chunk_target_before_grouping->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_target_before_grouping->exprs, + /* nappinfos = */ 1, + &appinfo)); + /* + * Note that we cannot use apply_projection_to_path() here, because it might + * modify the targetlist of the projection-capable paths in place, which + * would cause a mismatch when these paths are used in another context. + */ + subpath = (Path *) + create_projection_path(root, subpath->parent, subpath, chunk_target_before_grouping); if (can_sort) { - AggPath *agg_path = - create_sorted_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); + AggPath *agg_path = create_sorted_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); *sorted_paths = lappend(*sorted_paths, (Path *) agg_path); } if (can_hash) { - AggPath *agg_path = - create_hashed_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); + AggPath *agg_path = create_hashed_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); *hashed_paths = lappend(*hashed_paths, (Path *) agg_path); } @@ -256,10 +296,11 @@ add_partially_aggregated_subpaths(PlannerInfo *root, Path *parent_path, * AGGSPLIT_FINAL_DESERIAL step. */ static void -generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *output_rel, - RelOptInfo *partially_grouped_rel, PathTarget *grouping_target, - PathTarget *partial_grouping_target, bool can_sort, bool can_hash, - double d_num_groups, GroupPathExtraData *extra_data) +generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *input_rel, + RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, + PathTarget *grouping_target, PathTarget *partial_grouping_target, + bool can_sort, bool can_hash, double d_num_groups, + GroupPathExtraData *extra_data) { /* Get subpaths */ List *subpaths = get_subpaths_from_append_path(cheapest_total_path, false); @@ -306,7 +347,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI Path *subsubpath = lfirst(lc2); add_partially_aggregated_subpaths(root, - cheapest_total_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -338,7 +379,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI else { add_partially_aggregated_subpaths(root, - cheapest_total_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -384,9 +425,10 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI */ static void generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_path, - RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, - PathTarget *grouping_target, PathTarget *partial_grouping_target, - bool can_sort, bool can_hash, double d_num_groups, + RelOptInfo *input_rel, RelOptInfo *output_rel, + RelOptInfo *partially_grouped_rel, PathTarget *grouping_target, + PathTarget *partial_grouping_target, bool can_sort, + bool can_hash, double d_num_groups, GroupPathExtraData *extra_data) { /* Get subpaths */ @@ -420,7 +462,7 @@ generate_partial_agg_pushdown_path(PlannerInfo *root, Path *cheapest_partial_pat Assert(get_subpaths_from_append_path(subpath, false) == NIL); add_partially_aggregated_subpaths(root, - cheapest_partial_path, + input_rel->reltarget, partial_grouping_target, d_num_groups, extra_data, @@ -645,6 +687,7 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re Assert(cheapest_total_path != NULL); generate_agg_pushdown_path(root, cheapest_total_path, + input_rel, output_rel, partially_grouped_rel, grouping_target, @@ -660,6 +703,7 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re Path *cheapest_partial_path = linitial(input_rel->partial_pathlist); generate_partial_agg_pushdown_path(root, cheapest_partial_path, + input_rel, output_rel, partially_grouped_rel, grouping_target, From 144b89e0374adcdf034a1a7fdb4682b6d8f6cab9 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:34:47 +0200 Subject: [PATCH 097/157] refs --- test/expected/agg_bookends.out | 35 +- test/expected/append-14.out | 64 +- test/expected/append-15.out | 56 +- test/expected/append-16.out | 56 +- test/expected/insert_many.out | 904 +++++---------------- test/expected/parallel-14.out | 71 +- test/expected/parallel-15.out | 68 +- test/expected/parallel-16.out | 68 +- test/expected/partitionwise-14.out | 186 ++--- test/expected/partitionwise-15.out | 186 ++--- test/expected/partitionwise-16.out | 186 ++--- test/expected/query-14.out | 108 +-- test/expected/query-15.out | 124 +-- test/expected/query-16.out | 124 +-- test/expected/sql_query.out | 68 +- test/sql/partitionwise.sql.in | 6 +- test/sql/updates/setup.continuous_aggs.sql | 9 - 17 files changed, 745 insertions(+), 1574 deletions(-) diff --git a/test/expected/agg_bookends.out b/test/expected/agg_bookends.out index 6f3c0d3f222..28e61df849a 100644 --- a/test/expected/agg_bookends.out +++ b/test/expected/agg_bookends.out @@ -379,36 +379,21 @@ INSERT INTO btest_numeric VALUES('2020-01-20T09:00:43', 30.5); -- can't do index scan when using group by :PREFIX SELECT last(temp, time) FROM btest GROUP BY gp ORDER BY gp; - QUERY PLAN ------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------ Sort (actual rows=2 loops=1) Sort Key: _hyper_1_1_chunk.gp Sort Method: quicksort - -> Finalize HashAggregate (actual rows=2 loops=1) + -> HashAggregate (actual rows=2 loops=1) Group Key: _hyper_1_1_chunk.gp Batches: 1 - -> Append (actual rows=6 loops=1) - -> Partial HashAggregate (actual rows=2 loops=1) - Group Key: _hyper_1_1_chunk.gp - Batches: 1 - -> Seq Scan on _hyper_1_1_chunk (actual rows=6 loops=1) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: _hyper_1_2_chunk.gp - Batches: 1 - -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: _hyper_1_3_chunk.gp - Batches: 1 - -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: _hyper_1_4_chunk.gp - Batches: 1 - -> Seq Scan on _hyper_1_4_chunk (actual rows=1 loops=1) - -> Partial HashAggregate (actual rows=1 loops=1) - Group Key: _hyper_1_5_chunk.gp - Batches: 1 - -> Seq Scan on _hyper_1_5_chunk (actual rows=1 loops=1) -(27 rows) + -> Append (actual rows=11 loops=1) + -> Seq Scan on _hyper_1_1_chunk (actual rows=6 loops=1) + -> Seq Scan on _hyper_1_2_chunk (actual rows=2 loops=1) + -> Seq Scan on _hyper_1_3_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_1_4_chunk (actual rows=1 loops=1) + -> Seq Scan on _hyper_1_5_chunk (actual rows=1 loops=1) +(12 rows) -- do index scan when agg function is used in CTE subquery :PREFIX WITH last_temp AS (SELECT last(temp, time) FROM btest) SELECT * from last_temp; diff --git a/test/expected/append-14.out b/test/expected/append-14.out index 85c36867eb1..8e449cb917b 100644 --- a/test/expected/append-14.out +++ b/test/expected/append-14.out @@ -320,22 +320,18 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=1 loops=1) + QUERY PLAN +---------------------------------------------------------------------------------------------------------------- + GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Custom Scan (ChunkAppend) on append_test (actual rows=2 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) Order: date_trunc('year'::text, append_test."time") DESC Chunks excluded during startup: 1 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: date_trunc('year'::text, _hyper_1_3_chunk."time") - -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: date_trunc('year'::text, _hyper_1_2_chunk."time") - -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(13 rows) + -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) + -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) +(9 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -401,8 +397,8 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -412,29 +408,21 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Hash (actual rows=3 loops=1) Buckets: 1024 Batches: 1 -> Subquery Scan on data (actual rows=3 loops=1) - -> Finalize GroupAggregate (actual rows=3 loops=1) - Group Key: (time_bucket('@ 30 days'::interval, append_test."time")) - -> Sort (actual rows=3 loops=1) - Sort Key: (time_bucket('@ 30 days'::interval, append_test."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) - Chunks excluded during startup: 0 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_1_chunk."time") - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_2_chunk."time") - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_3_chunk."time") - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(31 rows) + -> HashAggregate (actual rows=3 loops=1) + Group Key: time_bucket('@ 30 days'::interval, append_test."time") + Batches: 1 + -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) + Chunks excluded during startup: 0 + -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) +(23 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE diff --git a/test/expected/append-15.out b/test/expected/append-15.out index 2a57feb231e..55f5ea6c74b 100644 --- a/test/expected/append-15.out +++ b/test/expected/append-15.out @@ -322,20 +322,17 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=1 loops=1) + GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Custom Scan (ChunkAppend) on append_test (actual rows=2 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: date_trunc('year'::text, _hyper_1_3_chunk."time") + -> Result (actual rows=3 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Order: date_trunc('year'::text, append_test."time") DESC + Chunks excluded during startup: 1 -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: date_trunc('year'::text, _hyper_1_2_chunk."time") -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(13 rows) +(10 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -401,8 +398,8 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -412,29 +409,22 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Hash (actual rows=3 loops=1) Buckets: 1024 Batches: 1 -> Subquery Scan on data (actual rows=3 loops=1) - -> Finalize GroupAggregate (actual rows=3 loops=1) - Group Key: (time_bucket('@ 30 days'::interval, append_test."time")) - -> Sort (actual rows=3 loops=1) - Sort Key: (time_bucket('@ 30 days'::interval, append_test."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + -> HashAggregate (actual rows=3 loops=1) + Group Key: time_bucket('@ 30 days'::interval, append_test."time") + Batches: 1 + -> Result (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) Chunks excluded during startup: 0 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_1_chunk."time") - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_2_chunk."time") - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_3_chunk."time") - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(31 rows) + -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) +(24 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE diff --git a/test/expected/append-16.out b/test/expected/append-16.out index 23e6b161a01..f2fa0f74cbc 100644 --- a/test/expected/append-16.out +++ b/test/expected/append-16.out @@ -322,20 +322,17 @@ psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! psql:include/append_query.sql:62: NOTICE: Stable function now_s() called! QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=1 loops=1) + GroupAggregate (actual rows=1 loops=1) Group Key: (date_trunc('year'::text, append_test."time")) - -> Custom Scan (ChunkAppend) on append_test (actual rows=2 loops=1) - Order: date_trunc('year'::text, append_test."time") DESC - Chunks excluded during startup: 1 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: date_trunc('year'::text, _hyper_1_3_chunk."time") + -> Result (actual rows=3 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + Order: date_trunc('year'::text, append_test."time") DESC + Chunks excluded during startup: 1 -> Index Scan using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: date_trunc('year'::text, _hyper_1_2_chunk."time") -> Index Scan using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) Index Cond: ("time" > (now_s() - '@ 4 mons'::interval)) -(13 rows) +(10 rows) -- querying outside the time range should return nothing. This tests -- that ConstraintAwareAppend can handle the case when an Append node @@ -401,8 +398,8 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=6 loops=1) Sort Key: (time_bucket('@ 30 days'::interval, "time"."time")) Sort Method: quicksort @@ -412,29 +409,22 @@ psql:include/append_query.sql:102: NOTICE: Stable function now_s() called! -> Hash (actual rows=3 loops=1) Buckets: 1024 Batches: 1 -> Subquery Scan on data (actual rows=3 loops=1) - -> Finalize GroupAggregate (actual rows=3 loops=1) - Group Key: (time_bucket('@ 30 days'::interval, append_test."time")) - -> Sort (actual rows=3 loops=1) - Sort Key: (time_bucket('@ 30 days'::interval, append_test."time")) - Sort Method: quicksort - -> Custom Scan (ChunkAppend) on append_test (actual rows=3 loops=1) + -> HashAggregate (actual rows=3 loops=1) + Group Key: time_bucket('@ 30 days'::interval, append_test."time") + Batches: 1 + -> Result (actual rows=5 loops=1) + -> Custom Scan (ChunkAppend) on append_test (actual rows=5 loops=1) Chunks excluded during startup: 0 - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_1_chunk."time") - -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_2_chunk."time") - -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket('@ 30 days'::interval, _hyper_1_3_chunk."time") - -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) - Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) - Filter: (colorid > 0) -(31 rows) + -> Index Scan Backward using _hyper_1_1_chunk_append_test_time_idx on _hyper_1_1_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Index Scan Backward using _hyper_1_2_chunk_append_test_time_idx on _hyper_1_2_chunk (actual rows=2 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) + -> Index Scan Backward using _hyper_1_3_chunk_append_test_time_idx on _hyper_1_3_chunk (actual rows=1 loops=1) + Index Cond: ("time" > (now_s() - '@ 400 days'::interval)) + Filter: (colorid > 0) +(24 rows) WITH data AS ( SELECT time_bucket(INTERVAL '30 day', TIME) AS btime, AVG(temp) AS VALUE diff --git a/test/expected/insert_many.out b/test/expected/insert_many.out index a5d24bd05d3..d1f5c1b76aa 100644 --- a/test/expected/insert_many.out +++ b/test/expected/insert_many.out @@ -44,907 +44,375 @@ INSERT INTO many_partitions_test_1m(time, temp, device) SELECT time_bucket('1 minute', time) AS period, avg(temp), device FROM many_partitions_test GROUP BY period, device; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------- Custom Scan (HypertableModify) -> Insert on public.many_partitions_test_1m -> Custom Scan (ChunkDispatch) Output: "*SELECT*".period, "*SELECT*".avg, "*SELECT*".device - -> Finalize HashAggregate + -> HashAggregate Output: (time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time")), avg(_hyper_1_1_chunk.temp), _hyper_1_1_chunk.device - Group Key: (time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.temp, _hyper_1_1_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.temp, _hyper_1_2_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.temp, _hyper_1_3_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_5_chunk."time")), _hyper_1_5_chunk.device, PARTIAL avg(_hyper_1_5_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_5_chunk."time"), _hyper_1_5_chunk.device + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.temp, _hyper_1_4_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_5_chunk."time"), _hyper_1_5_chunk.device, _hyper_1_5_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_6_chunk."time")), _hyper_1_6_chunk.device, PARTIAL avg(_hyper_1_6_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_6_chunk."time"), _hyper_1_6_chunk.device + Output: _hyper_1_5_chunk."time", _hyper_1_5_chunk.temp, _hyper_1_5_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_6_chunk."time"), _hyper_1_6_chunk.device, _hyper_1_6_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_7_chunk."time")), _hyper_1_7_chunk.device, PARTIAL avg(_hyper_1_7_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_7_chunk."time"), _hyper_1_7_chunk.device + Output: _hyper_1_6_chunk."time", _hyper_1_6_chunk.temp, _hyper_1_6_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_7_chunk."time"), _hyper_1_7_chunk.device, _hyper_1_7_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_8_chunk."time")), _hyper_1_8_chunk.device, PARTIAL avg(_hyper_1_8_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_8_chunk."time"), _hyper_1_8_chunk.device + Output: _hyper_1_7_chunk."time", _hyper_1_7_chunk.temp, _hyper_1_7_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_8_chunk."time"), _hyper_1_8_chunk.device, _hyper_1_8_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_9_chunk."time")), _hyper_1_9_chunk.device, PARTIAL avg(_hyper_1_9_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_9_chunk."time"), _hyper_1_9_chunk.device + Output: _hyper_1_8_chunk."time", _hyper_1_8_chunk.temp, _hyper_1_8_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_9_chunk."time"), _hyper_1_9_chunk.device, _hyper_1_9_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_10_chunk."time")), _hyper_1_10_chunk.device, PARTIAL avg(_hyper_1_10_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_10_chunk."time"), _hyper_1_10_chunk.device + Output: _hyper_1_9_chunk."time", _hyper_1_9_chunk.temp, _hyper_1_9_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_10_chunk."time"), _hyper_1_10_chunk.device, _hyper_1_10_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_11_chunk."time")), _hyper_1_11_chunk.device, PARTIAL avg(_hyper_1_11_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_11_chunk."time"), _hyper_1_11_chunk.device + Output: _hyper_1_10_chunk."time", _hyper_1_10_chunk.temp, _hyper_1_10_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_11_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_11_chunk."time"), _hyper_1_11_chunk.device, _hyper_1_11_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_12_chunk."time")), _hyper_1_12_chunk.device, PARTIAL avg(_hyper_1_12_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_12_chunk."time"), _hyper_1_12_chunk.device + Output: _hyper_1_11_chunk."time", _hyper_1_11_chunk.temp, _hyper_1_11_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_12_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_12_chunk."time"), _hyper_1_12_chunk.device, _hyper_1_12_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_13_chunk."time")), _hyper_1_13_chunk.device, PARTIAL avg(_hyper_1_13_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_13_chunk."time"), _hyper_1_13_chunk.device + Output: _hyper_1_12_chunk."time", _hyper_1_12_chunk.temp, _hyper_1_12_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_13_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_13_chunk."time"), _hyper_1_13_chunk.device, _hyper_1_13_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_14_chunk."time")), _hyper_1_14_chunk.device, PARTIAL avg(_hyper_1_14_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_14_chunk."time"), _hyper_1_14_chunk.device + Output: _hyper_1_13_chunk."time", _hyper_1_13_chunk.temp, _hyper_1_13_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_14_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_14_chunk."time"), _hyper_1_14_chunk.device, _hyper_1_14_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_15_chunk."time")), _hyper_1_15_chunk.device, PARTIAL avg(_hyper_1_15_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_15_chunk."time"), _hyper_1_15_chunk.device + Output: _hyper_1_14_chunk."time", _hyper_1_14_chunk.temp, _hyper_1_14_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_15_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_15_chunk."time"), _hyper_1_15_chunk.device, _hyper_1_15_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_16_chunk."time")), _hyper_1_16_chunk.device, PARTIAL avg(_hyper_1_16_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_16_chunk."time"), _hyper_1_16_chunk.device + Output: _hyper_1_15_chunk."time", _hyper_1_15_chunk.temp, _hyper_1_15_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_16_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_16_chunk."time"), _hyper_1_16_chunk.device, _hyper_1_16_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_17_chunk."time")), _hyper_1_17_chunk.device, PARTIAL avg(_hyper_1_17_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_17_chunk."time"), _hyper_1_17_chunk.device + Output: _hyper_1_16_chunk."time", _hyper_1_16_chunk.temp, _hyper_1_16_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_17_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_17_chunk."time"), _hyper_1_17_chunk.device, _hyper_1_17_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_18_chunk."time")), _hyper_1_18_chunk.device, PARTIAL avg(_hyper_1_18_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_18_chunk."time"), _hyper_1_18_chunk.device + Output: _hyper_1_17_chunk."time", _hyper_1_17_chunk.temp, _hyper_1_17_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_18_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_18_chunk."time"), _hyper_1_18_chunk.device, _hyper_1_18_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_19_chunk."time")), _hyper_1_19_chunk.device, PARTIAL avg(_hyper_1_19_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_19_chunk."time"), _hyper_1_19_chunk.device + Output: _hyper_1_18_chunk."time", _hyper_1_18_chunk.temp, _hyper_1_18_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_19_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_19_chunk."time"), _hyper_1_19_chunk.device, _hyper_1_19_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_20_chunk."time")), _hyper_1_20_chunk.device, PARTIAL avg(_hyper_1_20_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_20_chunk."time"), _hyper_1_20_chunk.device + Output: _hyper_1_19_chunk."time", _hyper_1_19_chunk.temp, _hyper_1_19_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_20_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_20_chunk."time"), _hyper_1_20_chunk.device, _hyper_1_20_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_21_chunk."time")), _hyper_1_21_chunk.device, PARTIAL avg(_hyper_1_21_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_21_chunk."time"), _hyper_1_21_chunk.device + Output: _hyper_1_20_chunk."time", _hyper_1_20_chunk.temp, _hyper_1_20_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_21_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_21_chunk."time"), _hyper_1_21_chunk.device, _hyper_1_21_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_22_chunk."time")), _hyper_1_22_chunk.device, PARTIAL avg(_hyper_1_22_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_22_chunk."time"), _hyper_1_22_chunk.device + Output: _hyper_1_21_chunk."time", _hyper_1_21_chunk.temp, _hyper_1_21_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_22_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_22_chunk."time"), _hyper_1_22_chunk.device, _hyper_1_22_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_23_chunk."time")), _hyper_1_23_chunk.device, PARTIAL avg(_hyper_1_23_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_23_chunk."time"), _hyper_1_23_chunk.device + Output: _hyper_1_22_chunk."time", _hyper_1_22_chunk.temp, _hyper_1_22_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_23_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_23_chunk."time"), _hyper_1_23_chunk.device, _hyper_1_23_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_24_chunk."time")), _hyper_1_24_chunk.device, PARTIAL avg(_hyper_1_24_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_24_chunk."time"), _hyper_1_24_chunk.device + Output: _hyper_1_23_chunk."time", _hyper_1_23_chunk.temp, _hyper_1_23_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_24_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_24_chunk."time"), _hyper_1_24_chunk.device, _hyper_1_24_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_25_chunk."time")), _hyper_1_25_chunk.device, PARTIAL avg(_hyper_1_25_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_25_chunk."time"), _hyper_1_25_chunk.device + Output: _hyper_1_24_chunk."time", _hyper_1_24_chunk.temp, _hyper_1_24_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_25_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_25_chunk."time"), _hyper_1_25_chunk.device, _hyper_1_25_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_26_chunk."time")), _hyper_1_26_chunk.device, PARTIAL avg(_hyper_1_26_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_26_chunk."time"), _hyper_1_26_chunk.device + Output: _hyper_1_25_chunk."time", _hyper_1_25_chunk.temp, _hyper_1_25_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_26_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_26_chunk."time"), _hyper_1_26_chunk.device, _hyper_1_26_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_27_chunk."time")), _hyper_1_27_chunk.device, PARTIAL avg(_hyper_1_27_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_27_chunk."time"), _hyper_1_27_chunk.device + Output: _hyper_1_26_chunk."time", _hyper_1_26_chunk.temp, _hyper_1_26_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_27_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_27_chunk."time"), _hyper_1_27_chunk.device, _hyper_1_27_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_28_chunk."time")), _hyper_1_28_chunk.device, PARTIAL avg(_hyper_1_28_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_28_chunk."time"), _hyper_1_28_chunk.device + Output: _hyper_1_27_chunk."time", _hyper_1_27_chunk.temp, _hyper_1_27_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_28_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_28_chunk."time"), _hyper_1_28_chunk.device, _hyper_1_28_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_29_chunk."time")), _hyper_1_29_chunk.device, PARTIAL avg(_hyper_1_29_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_29_chunk."time"), _hyper_1_29_chunk.device + Output: _hyper_1_28_chunk."time", _hyper_1_28_chunk.temp, _hyper_1_28_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_29_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_29_chunk."time"), _hyper_1_29_chunk.device, _hyper_1_29_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_30_chunk."time")), _hyper_1_30_chunk.device, PARTIAL avg(_hyper_1_30_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_30_chunk."time"), _hyper_1_30_chunk.device + Output: _hyper_1_29_chunk."time", _hyper_1_29_chunk.temp, _hyper_1_29_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_30_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_30_chunk."time"), _hyper_1_30_chunk.device, _hyper_1_30_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_31_chunk."time")), _hyper_1_31_chunk.device, PARTIAL avg(_hyper_1_31_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_31_chunk."time"), _hyper_1_31_chunk.device + Output: _hyper_1_30_chunk."time", _hyper_1_30_chunk.temp, _hyper_1_30_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_31_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_31_chunk."time"), _hyper_1_31_chunk.device, _hyper_1_31_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_32_chunk."time")), _hyper_1_32_chunk.device, PARTIAL avg(_hyper_1_32_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_32_chunk."time"), _hyper_1_32_chunk.device + Output: _hyper_1_31_chunk."time", _hyper_1_31_chunk.temp, _hyper_1_31_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_32_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_32_chunk."time"), _hyper_1_32_chunk.device, _hyper_1_32_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_33_chunk."time")), _hyper_1_33_chunk.device, PARTIAL avg(_hyper_1_33_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_33_chunk."time"), _hyper_1_33_chunk.device + Output: _hyper_1_32_chunk."time", _hyper_1_32_chunk.temp, _hyper_1_32_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_33_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_33_chunk."time"), _hyper_1_33_chunk.device, _hyper_1_33_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_34_chunk."time")), _hyper_1_34_chunk.device, PARTIAL avg(_hyper_1_34_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_34_chunk."time"), _hyper_1_34_chunk.device + Output: _hyper_1_33_chunk."time", _hyper_1_33_chunk.temp, _hyper_1_33_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_34_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_34_chunk."time"), _hyper_1_34_chunk.device, _hyper_1_34_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_35_chunk."time")), _hyper_1_35_chunk.device, PARTIAL avg(_hyper_1_35_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_35_chunk."time"), _hyper_1_35_chunk.device + Output: _hyper_1_34_chunk."time", _hyper_1_34_chunk.temp, _hyper_1_34_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_35_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_35_chunk."time"), _hyper_1_35_chunk.device, _hyper_1_35_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_36_chunk."time")), _hyper_1_36_chunk.device, PARTIAL avg(_hyper_1_36_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_36_chunk."time"), _hyper_1_36_chunk.device + Output: _hyper_1_35_chunk."time", _hyper_1_35_chunk.temp, _hyper_1_35_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_36_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_36_chunk."time"), _hyper_1_36_chunk.device, _hyper_1_36_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_37_chunk."time")), _hyper_1_37_chunk.device, PARTIAL avg(_hyper_1_37_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_37_chunk."time"), _hyper_1_37_chunk.device + Output: _hyper_1_36_chunk."time", _hyper_1_36_chunk.temp, _hyper_1_36_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_37_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_37_chunk."time"), _hyper_1_37_chunk.device, _hyper_1_37_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_38_chunk."time")), _hyper_1_38_chunk.device, PARTIAL avg(_hyper_1_38_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_38_chunk."time"), _hyper_1_38_chunk.device + Output: _hyper_1_37_chunk."time", _hyper_1_37_chunk.temp, _hyper_1_37_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_38_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_38_chunk."time"), _hyper_1_38_chunk.device, _hyper_1_38_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_39_chunk."time")), _hyper_1_39_chunk.device, PARTIAL avg(_hyper_1_39_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_39_chunk."time"), _hyper_1_39_chunk.device + Output: _hyper_1_38_chunk."time", _hyper_1_38_chunk.temp, _hyper_1_38_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_39_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_39_chunk."time"), _hyper_1_39_chunk.device, _hyper_1_39_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_40_chunk."time")), _hyper_1_40_chunk.device, PARTIAL avg(_hyper_1_40_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_40_chunk."time"), _hyper_1_40_chunk.device + Output: _hyper_1_39_chunk."time", _hyper_1_39_chunk.temp, _hyper_1_39_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_40_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_40_chunk."time"), _hyper_1_40_chunk.device, _hyper_1_40_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_41_chunk."time")), _hyper_1_41_chunk.device, PARTIAL avg(_hyper_1_41_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_41_chunk."time"), _hyper_1_41_chunk.device + Output: _hyper_1_40_chunk."time", _hyper_1_40_chunk.temp, _hyper_1_40_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_41_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_41_chunk."time"), _hyper_1_41_chunk.device, _hyper_1_41_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_42_chunk."time")), _hyper_1_42_chunk.device, PARTIAL avg(_hyper_1_42_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_42_chunk."time"), _hyper_1_42_chunk.device + Output: _hyper_1_41_chunk."time", _hyper_1_41_chunk.temp, _hyper_1_41_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_42_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_42_chunk."time"), _hyper_1_42_chunk.device, _hyper_1_42_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_43_chunk."time")), _hyper_1_43_chunk.device, PARTIAL avg(_hyper_1_43_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_43_chunk."time"), _hyper_1_43_chunk.device + Output: _hyper_1_42_chunk."time", _hyper_1_42_chunk.temp, _hyper_1_42_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_43_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_43_chunk."time"), _hyper_1_43_chunk.device, _hyper_1_43_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_44_chunk."time")), _hyper_1_44_chunk.device, PARTIAL avg(_hyper_1_44_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_44_chunk."time"), _hyper_1_44_chunk.device + Output: _hyper_1_43_chunk."time", _hyper_1_43_chunk.temp, _hyper_1_43_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_44_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_44_chunk."time"), _hyper_1_44_chunk.device, _hyper_1_44_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_45_chunk."time")), _hyper_1_45_chunk.device, PARTIAL avg(_hyper_1_45_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_45_chunk."time"), _hyper_1_45_chunk.device + Output: _hyper_1_44_chunk."time", _hyper_1_44_chunk.temp, _hyper_1_44_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_45_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_45_chunk."time"), _hyper_1_45_chunk.device, _hyper_1_45_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_46_chunk."time")), _hyper_1_46_chunk.device, PARTIAL avg(_hyper_1_46_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_46_chunk."time"), _hyper_1_46_chunk.device + Output: _hyper_1_45_chunk."time", _hyper_1_45_chunk.temp, _hyper_1_45_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_46_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_46_chunk."time"), _hyper_1_46_chunk.device, _hyper_1_46_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_47_chunk."time")), _hyper_1_47_chunk.device, PARTIAL avg(_hyper_1_47_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_47_chunk."time"), _hyper_1_47_chunk.device + Output: _hyper_1_46_chunk."time", _hyper_1_46_chunk.temp, _hyper_1_46_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_47_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_47_chunk."time"), _hyper_1_47_chunk.device, _hyper_1_47_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_48_chunk."time")), _hyper_1_48_chunk.device, PARTIAL avg(_hyper_1_48_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_48_chunk."time"), _hyper_1_48_chunk.device + Output: _hyper_1_47_chunk."time", _hyper_1_47_chunk.temp, _hyper_1_47_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_48_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_48_chunk."time"), _hyper_1_48_chunk.device, _hyper_1_48_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_49_chunk."time")), _hyper_1_49_chunk.device, PARTIAL avg(_hyper_1_49_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_49_chunk."time"), _hyper_1_49_chunk.device + Output: _hyper_1_48_chunk."time", _hyper_1_48_chunk.temp, _hyper_1_48_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_49_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_49_chunk."time"), _hyper_1_49_chunk.device, _hyper_1_49_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_50_chunk."time")), _hyper_1_50_chunk.device, PARTIAL avg(_hyper_1_50_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_50_chunk."time"), _hyper_1_50_chunk.device + Output: _hyper_1_49_chunk."time", _hyper_1_49_chunk.temp, _hyper_1_49_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_50_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_50_chunk."time"), _hyper_1_50_chunk.device, _hyper_1_50_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_51_chunk."time")), _hyper_1_51_chunk.device, PARTIAL avg(_hyper_1_51_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_51_chunk."time"), _hyper_1_51_chunk.device + Output: _hyper_1_50_chunk."time", _hyper_1_50_chunk.temp, _hyper_1_50_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_51_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_51_chunk."time"), _hyper_1_51_chunk.device, _hyper_1_51_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_52_chunk."time")), _hyper_1_52_chunk.device, PARTIAL avg(_hyper_1_52_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_52_chunk."time"), _hyper_1_52_chunk.device + Output: _hyper_1_51_chunk."time", _hyper_1_51_chunk.temp, _hyper_1_51_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_52_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_52_chunk."time"), _hyper_1_52_chunk.device, _hyper_1_52_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_53_chunk."time")), _hyper_1_53_chunk.device, PARTIAL avg(_hyper_1_53_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_53_chunk."time"), _hyper_1_53_chunk.device + Output: _hyper_1_52_chunk."time", _hyper_1_52_chunk.temp, _hyper_1_52_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_53_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_53_chunk."time"), _hyper_1_53_chunk.device, _hyper_1_53_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_54_chunk."time")), _hyper_1_54_chunk.device, PARTIAL avg(_hyper_1_54_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_54_chunk."time"), _hyper_1_54_chunk.device + Output: _hyper_1_53_chunk."time", _hyper_1_53_chunk.temp, _hyper_1_53_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_54_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_54_chunk."time"), _hyper_1_54_chunk.device, _hyper_1_54_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_55_chunk."time")), _hyper_1_55_chunk.device, PARTIAL avg(_hyper_1_55_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_55_chunk."time"), _hyper_1_55_chunk.device + Output: _hyper_1_54_chunk."time", _hyper_1_54_chunk.temp, _hyper_1_54_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_55_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_55_chunk."time"), _hyper_1_55_chunk.device, _hyper_1_55_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_56_chunk."time")), _hyper_1_56_chunk.device, PARTIAL avg(_hyper_1_56_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_56_chunk."time"), _hyper_1_56_chunk.device + Output: _hyper_1_55_chunk."time", _hyper_1_55_chunk.temp, _hyper_1_55_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_56_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_56_chunk."time"), _hyper_1_56_chunk.device, _hyper_1_56_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_57_chunk."time")), _hyper_1_57_chunk.device, PARTIAL avg(_hyper_1_57_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_57_chunk."time"), _hyper_1_57_chunk.device + Output: _hyper_1_56_chunk."time", _hyper_1_56_chunk.temp, _hyper_1_56_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_57_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_57_chunk."time"), _hyper_1_57_chunk.device, _hyper_1_57_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_58_chunk."time")), _hyper_1_58_chunk.device, PARTIAL avg(_hyper_1_58_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_58_chunk."time"), _hyper_1_58_chunk.device + Output: _hyper_1_57_chunk."time", _hyper_1_57_chunk.temp, _hyper_1_57_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_58_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_58_chunk."time"), _hyper_1_58_chunk.device, _hyper_1_58_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_59_chunk."time")), _hyper_1_59_chunk.device, PARTIAL avg(_hyper_1_59_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_59_chunk."time"), _hyper_1_59_chunk.device + Output: _hyper_1_58_chunk."time", _hyper_1_58_chunk.temp, _hyper_1_58_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_59_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_59_chunk."time"), _hyper_1_59_chunk.device, _hyper_1_59_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_60_chunk."time")), _hyper_1_60_chunk.device, PARTIAL avg(_hyper_1_60_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_60_chunk."time"), _hyper_1_60_chunk.device + Output: _hyper_1_59_chunk."time", _hyper_1_59_chunk.temp, _hyper_1_59_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_60_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_60_chunk."time"), _hyper_1_60_chunk.device, _hyper_1_60_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_61_chunk."time")), _hyper_1_61_chunk.device, PARTIAL avg(_hyper_1_61_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_61_chunk."time"), _hyper_1_61_chunk.device + Output: _hyper_1_60_chunk."time", _hyper_1_60_chunk.temp, _hyper_1_60_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_61_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_61_chunk."time"), _hyper_1_61_chunk.device, _hyper_1_61_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_62_chunk."time")), _hyper_1_62_chunk.device, PARTIAL avg(_hyper_1_62_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_62_chunk."time"), _hyper_1_62_chunk.device + Output: _hyper_1_61_chunk."time", _hyper_1_61_chunk.temp, _hyper_1_61_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_62_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_62_chunk."time"), _hyper_1_62_chunk.device, _hyper_1_62_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_63_chunk."time")), _hyper_1_63_chunk.device, PARTIAL avg(_hyper_1_63_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_63_chunk."time"), _hyper_1_63_chunk.device + Output: _hyper_1_62_chunk."time", _hyper_1_62_chunk.temp, _hyper_1_62_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_63_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_63_chunk."time"), _hyper_1_63_chunk.device, _hyper_1_63_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_64_chunk."time")), _hyper_1_64_chunk.device, PARTIAL avg(_hyper_1_64_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_64_chunk."time"), _hyper_1_64_chunk.device + Output: _hyper_1_63_chunk."time", _hyper_1_63_chunk.temp, _hyper_1_63_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_64_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_64_chunk."time"), _hyper_1_64_chunk.device, _hyper_1_64_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_65_chunk."time")), _hyper_1_65_chunk.device, PARTIAL avg(_hyper_1_65_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_65_chunk."time"), _hyper_1_65_chunk.device + Output: _hyper_1_64_chunk."time", _hyper_1_64_chunk.temp, _hyper_1_64_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_65_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_65_chunk."time"), _hyper_1_65_chunk.device, _hyper_1_65_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_66_chunk."time")), _hyper_1_66_chunk.device, PARTIAL avg(_hyper_1_66_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_66_chunk."time"), _hyper_1_66_chunk.device + Output: _hyper_1_65_chunk."time", _hyper_1_65_chunk.temp, _hyper_1_65_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_66_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_66_chunk."time"), _hyper_1_66_chunk.device, _hyper_1_66_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_67_chunk."time")), _hyper_1_67_chunk.device, PARTIAL avg(_hyper_1_67_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_67_chunk."time"), _hyper_1_67_chunk.device + Output: _hyper_1_66_chunk."time", _hyper_1_66_chunk.temp, _hyper_1_66_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_67_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_67_chunk."time"), _hyper_1_67_chunk.device, _hyper_1_67_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_68_chunk."time")), _hyper_1_68_chunk.device, PARTIAL avg(_hyper_1_68_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_68_chunk."time"), _hyper_1_68_chunk.device + Output: _hyper_1_67_chunk."time", _hyper_1_67_chunk.temp, _hyper_1_67_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_68_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_68_chunk."time"), _hyper_1_68_chunk.device, _hyper_1_68_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_69_chunk."time")), _hyper_1_69_chunk.device, PARTIAL avg(_hyper_1_69_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_69_chunk."time"), _hyper_1_69_chunk.device + Output: _hyper_1_68_chunk."time", _hyper_1_68_chunk.temp, _hyper_1_68_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_69_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_69_chunk."time"), _hyper_1_69_chunk.device, _hyper_1_69_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_70_chunk."time")), _hyper_1_70_chunk.device, PARTIAL avg(_hyper_1_70_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_70_chunk."time"), _hyper_1_70_chunk.device + Output: _hyper_1_69_chunk."time", _hyper_1_69_chunk.temp, _hyper_1_69_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_70_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_70_chunk."time"), _hyper_1_70_chunk.device, _hyper_1_70_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_71_chunk."time")), _hyper_1_71_chunk.device, PARTIAL avg(_hyper_1_71_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_71_chunk."time"), _hyper_1_71_chunk.device + Output: _hyper_1_70_chunk."time", _hyper_1_70_chunk.temp, _hyper_1_70_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_71_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_71_chunk."time"), _hyper_1_71_chunk.device, _hyper_1_71_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_72_chunk."time")), _hyper_1_72_chunk.device, PARTIAL avg(_hyper_1_72_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_72_chunk."time"), _hyper_1_72_chunk.device + Output: _hyper_1_71_chunk."time", _hyper_1_71_chunk.temp, _hyper_1_71_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_72_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_72_chunk."time"), _hyper_1_72_chunk.device, _hyper_1_72_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_73_chunk."time")), _hyper_1_73_chunk.device, PARTIAL avg(_hyper_1_73_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_73_chunk."time"), _hyper_1_73_chunk.device + Output: _hyper_1_72_chunk."time", _hyper_1_72_chunk.temp, _hyper_1_72_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_73_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_73_chunk."time"), _hyper_1_73_chunk.device, _hyper_1_73_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_74_chunk."time")), _hyper_1_74_chunk.device, PARTIAL avg(_hyper_1_74_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_74_chunk."time"), _hyper_1_74_chunk.device + Output: _hyper_1_73_chunk."time", _hyper_1_73_chunk.temp, _hyper_1_73_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_74_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_74_chunk."time"), _hyper_1_74_chunk.device, _hyper_1_74_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_75_chunk."time")), _hyper_1_75_chunk.device, PARTIAL avg(_hyper_1_75_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_75_chunk."time"), _hyper_1_75_chunk.device + Output: _hyper_1_74_chunk."time", _hyper_1_74_chunk.temp, _hyper_1_74_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_75_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_75_chunk."time"), _hyper_1_75_chunk.device, _hyper_1_75_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_76_chunk."time")), _hyper_1_76_chunk.device, PARTIAL avg(_hyper_1_76_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_76_chunk."time"), _hyper_1_76_chunk.device + Output: _hyper_1_75_chunk."time", _hyper_1_75_chunk.temp, _hyper_1_75_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_76_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_76_chunk."time"), _hyper_1_76_chunk.device, _hyper_1_76_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_77_chunk."time")), _hyper_1_77_chunk.device, PARTIAL avg(_hyper_1_77_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_77_chunk."time"), _hyper_1_77_chunk.device + Output: _hyper_1_76_chunk."time", _hyper_1_76_chunk.temp, _hyper_1_76_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_77_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_77_chunk."time"), _hyper_1_77_chunk.device, _hyper_1_77_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_78_chunk."time")), _hyper_1_78_chunk.device, PARTIAL avg(_hyper_1_78_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_78_chunk."time"), _hyper_1_78_chunk.device + Output: _hyper_1_77_chunk."time", _hyper_1_77_chunk.temp, _hyper_1_77_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_78_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_78_chunk."time"), _hyper_1_78_chunk.device, _hyper_1_78_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_79_chunk."time")), _hyper_1_79_chunk.device, PARTIAL avg(_hyper_1_79_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_79_chunk."time"), _hyper_1_79_chunk.device + Output: _hyper_1_78_chunk."time", _hyper_1_78_chunk.temp, _hyper_1_78_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_79_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_79_chunk."time"), _hyper_1_79_chunk.device, _hyper_1_79_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_80_chunk."time")), _hyper_1_80_chunk.device, PARTIAL avg(_hyper_1_80_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_80_chunk."time"), _hyper_1_80_chunk.device + Output: _hyper_1_79_chunk."time", _hyper_1_79_chunk.temp, _hyper_1_79_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_80_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_80_chunk."time"), _hyper_1_80_chunk.device, _hyper_1_80_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_81_chunk."time")), _hyper_1_81_chunk.device, PARTIAL avg(_hyper_1_81_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_81_chunk."time"), _hyper_1_81_chunk.device + Output: _hyper_1_80_chunk."time", _hyper_1_80_chunk.temp, _hyper_1_80_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_81_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_81_chunk."time"), _hyper_1_81_chunk.device, _hyper_1_81_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_82_chunk."time")), _hyper_1_82_chunk.device, PARTIAL avg(_hyper_1_82_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_82_chunk."time"), _hyper_1_82_chunk.device + Output: _hyper_1_81_chunk."time", _hyper_1_81_chunk.temp, _hyper_1_81_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_82_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_82_chunk."time"), _hyper_1_82_chunk.device, _hyper_1_82_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_83_chunk."time")), _hyper_1_83_chunk.device, PARTIAL avg(_hyper_1_83_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_83_chunk."time"), _hyper_1_83_chunk.device + Output: _hyper_1_82_chunk."time", _hyper_1_82_chunk.temp, _hyper_1_82_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_83_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_83_chunk."time"), _hyper_1_83_chunk.device, _hyper_1_83_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_84_chunk."time")), _hyper_1_84_chunk.device, PARTIAL avg(_hyper_1_84_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_84_chunk."time"), _hyper_1_84_chunk.device + Output: _hyper_1_83_chunk."time", _hyper_1_83_chunk.temp, _hyper_1_83_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_84_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_84_chunk."time"), _hyper_1_84_chunk.device, _hyper_1_84_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_85_chunk."time")), _hyper_1_85_chunk.device, PARTIAL avg(_hyper_1_85_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_85_chunk."time"), _hyper_1_85_chunk.device + Output: _hyper_1_84_chunk."time", _hyper_1_84_chunk.temp, _hyper_1_84_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_85_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_85_chunk."time"), _hyper_1_85_chunk.device, _hyper_1_85_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_86_chunk."time")), _hyper_1_86_chunk.device, PARTIAL avg(_hyper_1_86_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_86_chunk."time"), _hyper_1_86_chunk.device + Output: _hyper_1_85_chunk."time", _hyper_1_85_chunk.temp, _hyper_1_85_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_86_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_86_chunk."time"), _hyper_1_86_chunk.device, _hyper_1_86_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_87_chunk."time")), _hyper_1_87_chunk.device, PARTIAL avg(_hyper_1_87_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_87_chunk."time"), _hyper_1_87_chunk.device + Output: _hyper_1_86_chunk."time", _hyper_1_86_chunk.temp, _hyper_1_86_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_87_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_87_chunk."time"), _hyper_1_87_chunk.device, _hyper_1_87_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_88_chunk."time")), _hyper_1_88_chunk.device, PARTIAL avg(_hyper_1_88_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_88_chunk."time"), _hyper_1_88_chunk.device + Output: _hyper_1_87_chunk."time", _hyper_1_87_chunk.temp, _hyper_1_87_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_88_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_88_chunk."time"), _hyper_1_88_chunk.device, _hyper_1_88_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_89_chunk."time")), _hyper_1_89_chunk.device, PARTIAL avg(_hyper_1_89_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_89_chunk."time"), _hyper_1_89_chunk.device + Output: _hyper_1_88_chunk."time", _hyper_1_88_chunk.temp, _hyper_1_88_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_89_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_89_chunk."time"), _hyper_1_89_chunk.device, _hyper_1_89_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_90_chunk."time")), _hyper_1_90_chunk.device, PARTIAL avg(_hyper_1_90_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_90_chunk."time"), _hyper_1_90_chunk.device + Output: _hyper_1_89_chunk."time", _hyper_1_89_chunk.temp, _hyper_1_89_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_90_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_90_chunk."time"), _hyper_1_90_chunk.device, _hyper_1_90_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_91_chunk."time")), _hyper_1_91_chunk.device, PARTIAL avg(_hyper_1_91_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_91_chunk."time"), _hyper_1_91_chunk.device + Output: _hyper_1_90_chunk."time", _hyper_1_90_chunk.temp, _hyper_1_90_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_91_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_91_chunk."time"), _hyper_1_91_chunk.device, _hyper_1_91_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_92_chunk."time")), _hyper_1_92_chunk.device, PARTIAL avg(_hyper_1_92_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_92_chunk."time"), _hyper_1_92_chunk.device + Output: _hyper_1_91_chunk."time", _hyper_1_91_chunk.temp, _hyper_1_91_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_92_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_92_chunk."time"), _hyper_1_92_chunk.device, _hyper_1_92_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_93_chunk."time")), _hyper_1_93_chunk.device, PARTIAL avg(_hyper_1_93_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_93_chunk."time"), _hyper_1_93_chunk.device + Output: _hyper_1_92_chunk."time", _hyper_1_92_chunk.temp, _hyper_1_92_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_93_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_93_chunk."time"), _hyper_1_93_chunk.device, _hyper_1_93_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_94_chunk."time")), _hyper_1_94_chunk.device, PARTIAL avg(_hyper_1_94_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_94_chunk."time"), _hyper_1_94_chunk.device + Output: _hyper_1_93_chunk."time", _hyper_1_93_chunk.temp, _hyper_1_93_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_94_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_94_chunk."time"), _hyper_1_94_chunk.device, _hyper_1_94_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_95_chunk."time")), _hyper_1_95_chunk.device, PARTIAL avg(_hyper_1_95_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_95_chunk."time"), _hyper_1_95_chunk.device + Output: _hyper_1_94_chunk."time", _hyper_1_94_chunk.temp, _hyper_1_94_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_95_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_95_chunk."time"), _hyper_1_95_chunk.device, _hyper_1_95_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_96_chunk."time")), _hyper_1_96_chunk.device, PARTIAL avg(_hyper_1_96_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_96_chunk."time"), _hyper_1_96_chunk.device + Output: _hyper_1_95_chunk."time", _hyper_1_95_chunk.temp, _hyper_1_95_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_96_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_96_chunk."time"), _hyper_1_96_chunk.device, _hyper_1_96_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_97_chunk."time")), _hyper_1_97_chunk.device, PARTIAL avg(_hyper_1_97_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_97_chunk."time"), _hyper_1_97_chunk.device + Output: _hyper_1_96_chunk."time", _hyper_1_96_chunk.temp, _hyper_1_96_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_97_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_97_chunk."time"), _hyper_1_97_chunk.device, _hyper_1_97_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_98_chunk."time")), _hyper_1_98_chunk.device, PARTIAL avg(_hyper_1_98_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_98_chunk."time"), _hyper_1_98_chunk.device + Output: _hyper_1_97_chunk."time", _hyper_1_97_chunk.temp, _hyper_1_97_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_98_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_98_chunk."time"), _hyper_1_98_chunk.device, _hyper_1_98_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_99_chunk."time")), _hyper_1_99_chunk.device, PARTIAL avg(_hyper_1_99_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_99_chunk."time"), _hyper_1_99_chunk.device + Output: _hyper_1_98_chunk."time", _hyper_1_98_chunk.temp, _hyper_1_98_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_99_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_99_chunk."time"), _hyper_1_99_chunk.device, _hyper_1_99_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_100_chunk."time")), _hyper_1_100_chunk.device, PARTIAL avg(_hyper_1_100_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_100_chunk."time"), _hyper_1_100_chunk.device + Output: _hyper_1_99_chunk."time", _hyper_1_99_chunk.temp, _hyper_1_99_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_100_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_100_chunk."time"), _hyper_1_100_chunk.device, _hyper_1_100_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_101_chunk."time")), _hyper_1_101_chunk.device, PARTIAL avg(_hyper_1_101_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_101_chunk."time"), _hyper_1_101_chunk.device + Output: _hyper_1_100_chunk."time", _hyper_1_100_chunk.temp, _hyper_1_100_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_101_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_101_chunk."time"), _hyper_1_101_chunk.device, _hyper_1_101_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_102_chunk."time")), _hyper_1_102_chunk.device, PARTIAL avg(_hyper_1_102_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_102_chunk."time"), _hyper_1_102_chunk.device + Output: _hyper_1_101_chunk."time", _hyper_1_101_chunk.temp, _hyper_1_101_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_102_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_102_chunk."time"), _hyper_1_102_chunk.device, _hyper_1_102_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_103_chunk."time")), _hyper_1_103_chunk.device, PARTIAL avg(_hyper_1_103_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_103_chunk."time"), _hyper_1_103_chunk.device + Output: _hyper_1_102_chunk."time", _hyper_1_102_chunk.temp, _hyper_1_102_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_103_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_103_chunk."time"), _hyper_1_103_chunk.device, _hyper_1_103_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_104_chunk."time")), _hyper_1_104_chunk.device, PARTIAL avg(_hyper_1_104_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_104_chunk."time"), _hyper_1_104_chunk.device + Output: _hyper_1_103_chunk."time", _hyper_1_103_chunk.temp, _hyper_1_103_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_104_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_104_chunk."time"), _hyper_1_104_chunk.device, _hyper_1_104_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_105_chunk."time")), _hyper_1_105_chunk.device, PARTIAL avg(_hyper_1_105_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_105_chunk."time"), _hyper_1_105_chunk.device + Output: _hyper_1_104_chunk."time", _hyper_1_104_chunk.temp, _hyper_1_104_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_105_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_105_chunk."time"), _hyper_1_105_chunk.device, _hyper_1_105_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_106_chunk."time")), _hyper_1_106_chunk.device, PARTIAL avg(_hyper_1_106_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_106_chunk."time"), _hyper_1_106_chunk.device + Output: _hyper_1_105_chunk."time", _hyper_1_105_chunk.temp, _hyper_1_105_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_106_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_106_chunk."time"), _hyper_1_106_chunk.device, _hyper_1_106_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_107_chunk."time")), _hyper_1_107_chunk.device, PARTIAL avg(_hyper_1_107_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_107_chunk."time"), _hyper_1_107_chunk.device + Output: _hyper_1_106_chunk."time", _hyper_1_106_chunk.temp, _hyper_1_106_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_107_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_107_chunk."time"), _hyper_1_107_chunk.device, _hyper_1_107_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_108_chunk."time")), _hyper_1_108_chunk.device, PARTIAL avg(_hyper_1_108_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_108_chunk."time"), _hyper_1_108_chunk.device + Output: _hyper_1_107_chunk."time", _hyper_1_107_chunk.temp, _hyper_1_107_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_108_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_108_chunk."time"), _hyper_1_108_chunk.device, _hyper_1_108_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_109_chunk."time")), _hyper_1_109_chunk.device, PARTIAL avg(_hyper_1_109_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_109_chunk."time"), _hyper_1_109_chunk.device + Output: _hyper_1_108_chunk."time", _hyper_1_108_chunk.temp, _hyper_1_108_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_109_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_109_chunk."time"), _hyper_1_109_chunk.device, _hyper_1_109_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_110_chunk."time")), _hyper_1_110_chunk.device, PARTIAL avg(_hyper_1_110_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_110_chunk."time"), _hyper_1_110_chunk.device + Output: _hyper_1_109_chunk."time", _hyper_1_109_chunk.temp, _hyper_1_109_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_110_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_110_chunk."time"), _hyper_1_110_chunk.device, _hyper_1_110_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_111_chunk."time")), _hyper_1_111_chunk.device, PARTIAL avg(_hyper_1_111_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_111_chunk."time"), _hyper_1_111_chunk.device + Output: _hyper_1_110_chunk."time", _hyper_1_110_chunk.temp, _hyper_1_110_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_111_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_111_chunk."time"), _hyper_1_111_chunk.device, _hyper_1_111_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_112_chunk."time")), _hyper_1_112_chunk.device, PARTIAL avg(_hyper_1_112_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_112_chunk."time"), _hyper_1_112_chunk.device + Output: _hyper_1_111_chunk."time", _hyper_1_111_chunk.temp, _hyper_1_111_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_112_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_112_chunk."time"), _hyper_1_112_chunk.device, _hyper_1_112_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_113_chunk."time")), _hyper_1_113_chunk.device, PARTIAL avg(_hyper_1_113_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_113_chunk."time"), _hyper_1_113_chunk.device + Output: _hyper_1_112_chunk."time", _hyper_1_112_chunk.temp, _hyper_1_112_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_113_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_113_chunk."time"), _hyper_1_113_chunk.device, _hyper_1_113_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_114_chunk."time")), _hyper_1_114_chunk.device, PARTIAL avg(_hyper_1_114_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_114_chunk."time"), _hyper_1_114_chunk.device + Output: _hyper_1_113_chunk."time", _hyper_1_113_chunk.temp, _hyper_1_113_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_114_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_114_chunk."time"), _hyper_1_114_chunk.device, _hyper_1_114_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_115_chunk."time")), _hyper_1_115_chunk.device, PARTIAL avg(_hyper_1_115_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_115_chunk."time"), _hyper_1_115_chunk.device + Output: _hyper_1_114_chunk."time", _hyper_1_114_chunk.temp, _hyper_1_114_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_115_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_115_chunk."time"), _hyper_1_115_chunk.device, _hyper_1_115_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_116_chunk."time")), _hyper_1_116_chunk.device, PARTIAL avg(_hyper_1_116_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_116_chunk."time"), _hyper_1_116_chunk.device + Output: _hyper_1_115_chunk."time", _hyper_1_115_chunk.temp, _hyper_1_115_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_116_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_116_chunk."time"), _hyper_1_116_chunk.device, _hyper_1_116_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_117_chunk."time")), _hyper_1_117_chunk.device, PARTIAL avg(_hyper_1_117_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_117_chunk."time"), _hyper_1_117_chunk.device + Output: _hyper_1_116_chunk."time", _hyper_1_116_chunk.temp, _hyper_1_116_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_117_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_117_chunk."time"), _hyper_1_117_chunk.device, _hyper_1_117_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_118_chunk."time")), _hyper_1_118_chunk.device, PARTIAL avg(_hyper_1_118_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_118_chunk."time"), _hyper_1_118_chunk.device + Output: _hyper_1_117_chunk."time", _hyper_1_117_chunk.temp, _hyper_1_117_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_118_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_118_chunk."time"), _hyper_1_118_chunk.device, _hyper_1_118_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_119_chunk."time")), _hyper_1_119_chunk.device, PARTIAL avg(_hyper_1_119_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_119_chunk."time"), _hyper_1_119_chunk.device + Output: _hyper_1_118_chunk."time", _hyper_1_118_chunk.temp, _hyper_1_118_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_119_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_119_chunk."time"), _hyper_1_119_chunk.device, _hyper_1_119_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_120_chunk."time")), _hyper_1_120_chunk.device, PARTIAL avg(_hyper_1_120_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_120_chunk."time"), _hyper_1_120_chunk.device + Output: _hyper_1_119_chunk."time", _hyper_1_119_chunk.temp, _hyper_1_119_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_120_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_120_chunk."time"), _hyper_1_120_chunk.device, _hyper_1_120_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_121_chunk."time")), _hyper_1_121_chunk.device, PARTIAL avg(_hyper_1_121_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_121_chunk."time"), _hyper_1_121_chunk.device + Output: _hyper_1_120_chunk."time", _hyper_1_120_chunk.temp, _hyper_1_120_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_121_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_121_chunk."time"), _hyper_1_121_chunk.device, _hyper_1_121_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_122_chunk."time")), _hyper_1_122_chunk.device, PARTIAL avg(_hyper_1_122_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_122_chunk."time"), _hyper_1_122_chunk.device + Output: _hyper_1_121_chunk."time", _hyper_1_121_chunk.temp, _hyper_1_121_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_122_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_122_chunk."time"), _hyper_1_122_chunk.device, _hyper_1_122_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_123_chunk."time")), _hyper_1_123_chunk.device, PARTIAL avg(_hyper_1_123_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_123_chunk."time"), _hyper_1_123_chunk.device + Output: _hyper_1_122_chunk."time", _hyper_1_122_chunk.temp, _hyper_1_122_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_123_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_123_chunk."time"), _hyper_1_123_chunk.device, _hyper_1_123_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_124_chunk."time")), _hyper_1_124_chunk.device, PARTIAL avg(_hyper_1_124_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_124_chunk."time"), _hyper_1_124_chunk.device + Output: _hyper_1_123_chunk."time", _hyper_1_123_chunk.temp, _hyper_1_123_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_124_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_124_chunk."time"), _hyper_1_124_chunk.device, _hyper_1_124_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_125_chunk."time")), _hyper_1_125_chunk.device, PARTIAL avg(_hyper_1_125_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_125_chunk."time"), _hyper_1_125_chunk.device + Output: _hyper_1_124_chunk."time", _hyper_1_124_chunk.temp, _hyper_1_124_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_125_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_125_chunk."time"), _hyper_1_125_chunk.device, _hyper_1_125_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_126_chunk."time")), _hyper_1_126_chunk.device, PARTIAL avg(_hyper_1_126_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_126_chunk."time"), _hyper_1_126_chunk.device + Output: _hyper_1_125_chunk."time", _hyper_1_125_chunk.temp, _hyper_1_125_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_126_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_126_chunk."time"), _hyper_1_126_chunk.device, _hyper_1_126_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_127_chunk."time")), _hyper_1_127_chunk.device, PARTIAL avg(_hyper_1_127_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_127_chunk."time"), _hyper_1_127_chunk.device + Output: _hyper_1_126_chunk."time", _hyper_1_126_chunk.temp, _hyper_1_126_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_127_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_127_chunk."time"), _hyper_1_127_chunk.device, _hyper_1_127_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_128_chunk."time")), _hyper_1_128_chunk.device, PARTIAL avg(_hyper_1_128_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_128_chunk."time"), _hyper_1_128_chunk.device + Output: _hyper_1_127_chunk."time", _hyper_1_127_chunk.temp, _hyper_1_127_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_128_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_128_chunk."time"), _hyper_1_128_chunk.device, _hyper_1_128_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_129_chunk."time")), _hyper_1_129_chunk.device, PARTIAL avg(_hyper_1_129_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_129_chunk."time"), _hyper_1_129_chunk.device + Output: _hyper_1_128_chunk."time", _hyper_1_128_chunk.temp, _hyper_1_128_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_129_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_129_chunk."time"), _hyper_1_129_chunk.device, _hyper_1_129_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_130_chunk."time")), _hyper_1_130_chunk.device, PARTIAL avg(_hyper_1_130_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_130_chunk."time"), _hyper_1_130_chunk.device + Output: _hyper_1_129_chunk."time", _hyper_1_129_chunk.temp, _hyper_1_129_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_130_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_130_chunk."time"), _hyper_1_130_chunk.device, _hyper_1_130_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_131_chunk."time")), _hyper_1_131_chunk.device, PARTIAL avg(_hyper_1_131_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_131_chunk."time"), _hyper_1_131_chunk.device + Output: _hyper_1_130_chunk."time", _hyper_1_130_chunk.temp, _hyper_1_130_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_131_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_131_chunk."time"), _hyper_1_131_chunk.device, _hyper_1_131_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_132_chunk."time")), _hyper_1_132_chunk.device, PARTIAL avg(_hyper_1_132_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_132_chunk."time"), _hyper_1_132_chunk.device + Output: _hyper_1_131_chunk."time", _hyper_1_131_chunk.temp, _hyper_1_131_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_132_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_132_chunk."time"), _hyper_1_132_chunk.device, _hyper_1_132_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_133_chunk."time")), _hyper_1_133_chunk.device, PARTIAL avg(_hyper_1_133_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_133_chunk."time"), _hyper_1_133_chunk.device + Output: _hyper_1_132_chunk."time", _hyper_1_132_chunk.temp, _hyper_1_132_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_133_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_133_chunk."time"), _hyper_1_133_chunk.device, _hyper_1_133_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_134_chunk."time")), _hyper_1_134_chunk.device, PARTIAL avg(_hyper_1_134_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_134_chunk."time"), _hyper_1_134_chunk.device + Output: _hyper_1_133_chunk."time", _hyper_1_133_chunk.temp, _hyper_1_133_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_134_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_134_chunk."time"), _hyper_1_134_chunk.device, _hyper_1_134_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_135_chunk."time")), _hyper_1_135_chunk.device, PARTIAL avg(_hyper_1_135_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_135_chunk."time"), _hyper_1_135_chunk.device + Output: _hyper_1_134_chunk."time", _hyper_1_134_chunk.temp, _hyper_1_134_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_135_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_135_chunk."time"), _hyper_1_135_chunk.device, _hyper_1_135_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_136_chunk."time")), _hyper_1_136_chunk.device, PARTIAL avg(_hyper_1_136_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_136_chunk."time"), _hyper_1_136_chunk.device + Output: _hyper_1_135_chunk."time", _hyper_1_135_chunk.temp, _hyper_1_135_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_136_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_136_chunk."time"), _hyper_1_136_chunk.device, _hyper_1_136_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_137_chunk."time")), _hyper_1_137_chunk.device, PARTIAL avg(_hyper_1_137_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_137_chunk."time"), _hyper_1_137_chunk.device + Output: _hyper_1_136_chunk."time", _hyper_1_136_chunk.temp, _hyper_1_136_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_137_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_137_chunk."time"), _hyper_1_137_chunk.device, _hyper_1_137_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_138_chunk."time")), _hyper_1_138_chunk.device, PARTIAL avg(_hyper_1_138_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_138_chunk."time"), _hyper_1_138_chunk.device + Output: _hyper_1_137_chunk."time", _hyper_1_137_chunk.temp, _hyper_1_137_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_138_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_138_chunk."time"), _hyper_1_138_chunk.device, _hyper_1_138_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_139_chunk."time")), _hyper_1_139_chunk.device, PARTIAL avg(_hyper_1_139_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_139_chunk."time"), _hyper_1_139_chunk.device + Output: _hyper_1_138_chunk."time", _hyper_1_138_chunk.temp, _hyper_1_138_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_139_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_139_chunk."time"), _hyper_1_139_chunk.device, _hyper_1_139_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_140_chunk."time")), _hyper_1_140_chunk.device, PARTIAL avg(_hyper_1_140_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_140_chunk."time"), _hyper_1_140_chunk.device + Output: _hyper_1_139_chunk."time", _hyper_1_139_chunk.temp, _hyper_1_139_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_140_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_140_chunk."time"), _hyper_1_140_chunk.device, _hyper_1_140_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_141_chunk."time")), _hyper_1_141_chunk.device, PARTIAL avg(_hyper_1_141_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_141_chunk."time"), _hyper_1_141_chunk.device + Output: _hyper_1_140_chunk."time", _hyper_1_140_chunk.temp, _hyper_1_140_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_141_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_141_chunk."time"), _hyper_1_141_chunk.device, _hyper_1_141_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_142_chunk."time")), _hyper_1_142_chunk.device, PARTIAL avg(_hyper_1_142_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_142_chunk."time"), _hyper_1_142_chunk.device + Output: _hyper_1_141_chunk."time", _hyper_1_141_chunk.temp, _hyper_1_141_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_142_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_142_chunk."time"), _hyper_1_142_chunk.device, _hyper_1_142_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_143_chunk."time")), _hyper_1_143_chunk.device, PARTIAL avg(_hyper_1_143_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_143_chunk."time"), _hyper_1_143_chunk.device + Output: _hyper_1_142_chunk."time", _hyper_1_142_chunk.temp, _hyper_1_142_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_143_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_143_chunk."time"), _hyper_1_143_chunk.device, _hyper_1_143_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_144_chunk."time")), _hyper_1_144_chunk.device, PARTIAL avg(_hyper_1_144_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_144_chunk."time"), _hyper_1_144_chunk.device + Output: _hyper_1_143_chunk."time", _hyper_1_143_chunk.temp, _hyper_1_143_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_144_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_144_chunk."time"), _hyper_1_144_chunk.device, _hyper_1_144_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_145_chunk."time")), _hyper_1_145_chunk.device, PARTIAL avg(_hyper_1_145_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_145_chunk."time"), _hyper_1_145_chunk.device + Output: _hyper_1_144_chunk."time", _hyper_1_144_chunk.temp, _hyper_1_144_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_145_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_145_chunk."time"), _hyper_1_145_chunk.device, _hyper_1_145_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_146_chunk."time")), _hyper_1_146_chunk.device, PARTIAL avg(_hyper_1_146_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_146_chunk."time"), _hyper_1_146_chunk.device + Output: _hyper_1_145_chunk."time", _hyper_1_145_chunk.temp, _hyper_1_145_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_146_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_146_chunk."time"), _hyper_1_146_chunk.device, _hyper_1_146_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_147_chunk."time")), _hyper_1_147_chunk.device, PARTIAL avg(_hyper_1_147_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_147_chunk."time"), _hyper_1_147_chunk.device + Output: _hyper_1_146_chunk."time", _hyper_1_146_chunk.temp, _hyper_1_146_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_147_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_147_chunk."time"), _hyper_1_147_chunk.device, _hyper_1_147_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_148_chunk."time")), _hyper_1_148_chunk.device, PARTIAL avg(_hyper_1_148_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_148_chunk."time"), _hyper_1_148_chunk.device + Output: _hyper_1_147_chunk."time", _hyper_1_147_chunk.temp, _hyper_1_147_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_148_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_148_chunk."time"), _hyper_1_148_chunk.device, _hyper_1_148_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_149_chunk."time")), _hyper_1_149_chunk.device, PARTIAL avg(_hyper_1_149_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_149_chunk."time"), _hyper_1_149_chunk.device + Output: _hyper_1_148_chunk."time", _hyper_1_148_chunk.temp, _hyper_1_148_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_149_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_149_chunk."time"), _hyper_1_149_chunk.device, _hyper_1_149_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_150_chunk."time")), _hyper_1_150_chunk.device, PARTIAL avg(_hyper_1_150_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_150_chunk."time"), _hyper_1_150_chunk.device + Output: _hyper_1_149_chunk."time", _hyper_1_149_chunk.temp, _hyper_1_149_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_150_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_150_chunk."time"), _hyper_1_150_chunk.device, _hyper_1_150_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_151_chunk."time")), _hyper_1_151_chunk.device, PARTIAL avg(_hyper_1_151_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_151_chunk."time"), _hyper_1_151_chunk.device + Output: _hyper_1_150_chunk."time", _hyper_1_150_chunk.temp, _hyper_1_150_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_151_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_151_chunk."time"), _hyper_1_151_chunk.device, _hyper_1_151_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_152_chunk."time")), _hyper_1_152_chunk.device, PARTIAL avg(_hyper_1_152_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_152_chunk."time"), _hyper_1_152_chunk.device + Output: _hyper_1_151_chunk."time", _hyper_1_151_chunk.temp, _hyper_1_151_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_152_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_152_chunk."time"), _hyper_1_152_chunk.device, _hyper_1_152_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_153_chunk."time")), _hyper_1_153_chunk.device, PARTIAL avg(_hyper_1_153_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_153_chunk."time"), _hyper_1_153_chunk.device + Output: _hyper_1_152_chunk."time", _hyper_1_152_chunk.temp, _hyper_1_152_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_153_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_153_chunk."time"), _hyper_1_153_chunk.device, _hyper_1_153_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_154_chunk."time")), _hyper_1_154_chunk.device, PARTIAL avg(_hyper_1_154_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_154_chunk."time"), _hyper_1_154_chunk.device + Output: _hyper_1_153_chunk."time", _hyper_1_153_chunk.temp, _hyper_1_153_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_154_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_154_chunk."time"), _hyper_1_154_chunk.device, _hyper_1_154_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_155_chunk."time")), _hyper_1_155_chunk.device, PARTIAL avg(_hyper_1_155_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_155_chunk."time"), _hyper_1_155_chunk.device + Output: _hyper_1_154_chunk."time", _hyper_1_154_chunk.temp, _hyper_1_154_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_155_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_155_chunk."time"), _hyper_1_155_chunk.device, _hyper_1_155_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_156_chunk."time")), _hyper_1_156_chunk.device, PARTIAL avg(_hyper_1_156_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_156_chunk."time"), _hyper_1_156_chunk.device + Output: _hyper_1_155_chunk."time", _hyper_1_155_chunk.temp, _hyper_1_155_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_156_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_156_chunk."time"), _hyper_1_156_chunk.device, _hyper_1_156_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_157_chunk."time")), _hyper_1_157_chunk.device, PARTIAL avg(_hyper_1_157_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_157_chunk."time"), _hyper_1_157_chunk.device + Output: _hyper_1_156_chunk."time", _hyper_1_156_chunk.temp, _hyper_1_156_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_157_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_157_chunk."time"), _hyper_1_157_chunk.device, _hyper_1_157_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_158_chunk."time")), _hyper_1_158_chunk.device, PARTIAL avg(_hyper_1_158_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_158_chunk."time"), _hyper_1_158_chunk.device + Output: _hyper_1_157_chunk."time", _hyper_1_157_chunk.temp, _hyper_1_157_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_158_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_158_chunk."time"), _hyper_1_158_chunk.device, _hyper_1_158_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_159_chunk."time")), _hyper_1_159_chunk.device, PARTIAL avg(_hyper_1_159_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_159_chunk."time"), _hyper_1_159_chunk.device + Output: _hyper_1_158_chunk."time", _hyper_1_158_chunk.temp, _hyper_1_158_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_159_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_159_chunk."time"), _hyper_1_159_chunk.device, _hyper_1_159_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_160_chunk."time")), _hyper_1_160_chunk.device, PARTIAL avg(_hyper_1_160_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_160_chunk."time"), _hyper_1_160_chunk.device + Output: _hyper_1_159_chunk."time", _hyper_1_159_chunk.temp, _hyper_1_159_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_160_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_160_chunk."time"), _hyper_1_160_chunk.device, _hyper_1_160_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_161_chunk."time")), _hyper_1_161_chunk.device, PARTIAL avg(_hyper_1_161_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_161_chunk."time"), _hyper_1_161_chunk.device + Output: _hyper_1_160_chunk."time", _hyper_1_160_chunk.temp, _hyper_1_160_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_161_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_161_chunk."time"), _hyper_1_161_chunk.device, _hyper_1_161_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_162_chunk."time")), _hyper_1_162_chunk.device, PARTIAL avg(_hyper_1_162_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_162_chunk."time"), _hyper_1_162_chunk.device + Output: _hyper_1_161_chunk."time", _hyper_1_161_chunk.temp, _hyper_1_161_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_162_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_162_chunk."time"), _hyper_1_162_chunk.device, _hyper_1_162_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_163_chunk."time")), _hyper_1_163_chunk.device, PARTIAL avg(_hyper_1_163_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_163_chunk."time"), _hyper_1_163_chunk.device + Output: _hyper_1_162_chunk."time", _hyper_1_162_chunk.temp, _hyper_1_162_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_163_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_163_chunk."time"), _hyper_1_163_chunk.device, _hyper_1_163_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_164_chunk."time")), _hyper_1_164_chunk.device, PARTIAL avg(_hyper_1_164_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_164_chunk."time"), _hyper_1_164_chunk.device + Output: _hyper_1_163_chunk."time", _hyper_1_163_chunk.temp, _hyper_1_163_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_164_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_164_chunk."time"), _hyper_1_164_chunk.device, _hyper_1_164_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_165_chunk."time")), _hyper_1_165_chunk.device, PARTIAL avg(_hyper_1_165_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_165_chunk."time"), _hyper_1_165_chunk.device + Output: _hyper_1_164_chunk."time", _hyper_1_164_chunk.temp, _hyper_1_164_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_165_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_165_chunk."time"), _hyper_1_165_chunk.device, _hyper_1_165_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_166_chunk."time")), _hyper_1_166_chunk.device, PARTIAL avg(_hyper_1_166_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_166_chunk."time"), _hyper_1_166_chunk.device + Output: _hyper_1_165_chunk."time", _hyper_1_165_chunk.temp, _hyper_1_165_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_166_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_166_chunk."time"), _hyper_1_166_chunk.device, _hyper_1_166_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_167_chunk."time")), _hyper_1_167_chunk.device, PARTIAL avg(_hyper_1_167_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_167_chunk."time"), _hyper_1_167_chunk.device + Output: _hyper_1_166_chunk."time", _hyper_1_166_chunk.temp, _hyper_1_166_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_167_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_167_chunk."time"), _hyper_1_167_chunk.device, _hyper_1_167_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_168_chunk."time")), _hyper_1_168_chunk.device, PARTIAL avg(_hyper_1_168_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_168_chunk."time"), _hyper_1_168_chunk.device + Output: _hyper_1_167_chunk."time", _hyper_1_167_chunk.temp, _hyper_1_167_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_168_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_168_chunk."time"), _hyper_1_168_chunk.device, _hyper_1_168_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_169_chunk."time")), _hyper_1_169_chunk.device, PARTIAL avg(_hyper_1_169_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_169_chunk."time"), _hyper_1_169_chunk.device + Output: _hyper_1_168_chunk."time", _hyper_1_168_chunk.temp, _hyper_1_168_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_169_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_169_chunk."time"), _hyper_1_169_chunk.device, _hyper_1_169_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_170_chunk."time")), _hyper_1_170_chunk.device, PARTIAL avg(_hyper_1_170_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_170_chunk."time"), _hyper_1_170_chunk.device + Output: _hyper_1_169_chunk."time", _hyper_1_169_chunk.temp, _hyper_1_169_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_170_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_170_chunk."time"), _hyper_1_170_chunk.device, _hyper_1_170_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_171_chunk."time")), _hyper_1_171_chunk.device, PARTIAL avg(_hyper_1_171_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_171_chunk."time"), _hyper_1_171_chunk.device + Output: _hyper_1_170_chunk."time", _hyper_1_170_chunk.temp, _hyper_1_170_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_171_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_171_chunk."time"), _hyper_1_171_chunk.device, _hyper_1_171_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_172_chunk."time")), _hyper_1_172_chunk.device, PARTIAL avg(_hyper_1_172_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_172_chunk."time"), _hyper_1_172_chunk.device + Output: _hyper_1_171_chunk."time", _hyper_1_171_chunk.temp, _hyper_1_171_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_172_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_172_chunk."time"), _hyper_1_172_chunk.device, _hyper_1_172_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_173_chunk."time")), _hyper_1_173_chunk.device, PARTIAL avg(_hyper_1_173_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_173_chunk."time"), _hyper_1_173_chunk.device + Output: _hyper_1_172_chunk."time", _hyper_1_172_chunk.temp, _hyper_1_172_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_173_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_173_chunk."time"), _hyper_1_173_chunk.device, _hyper_1_173_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_174_chunk."time")), _hyper_1_174_chunk.device, PARTIAL avg(_hyper_1_174_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_174_chunk."time"), _hyper_1_174_chunk.device + Output: _hyper_1_173_chunk."time", _hyper_1_173_chunk.temp, _hyper_1_173_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_174_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_174_chunk."time"), _hyper_1_174_chunk.device, _hyper_1_174_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_175_chunk."time")), _hyper_1_175_chunk.device, PARTIAL avg(_hyper_1_175_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_175_chunk."time"), _hyper_1_175_chunk.device + Output: _hyper_1_174_chunk."time", _hyper_1_174_chunk.temp, _hyper_1_174_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_175_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_175_chunk."time"), _hyper_1_175_chunk.device, _hyper_1_175_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_176_chunk."time")), _hyper_1_176_chunk.device, PARTIAL avg(_hyper_1_176_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_176_chunk."time"), _hyper_1_176_chunk.device + Output: _hyper_1_175_chunk."time", _hyper_1_175_chunk.temp, _hyper_1_175_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_176_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_176_chunk."time"), _hyper_1_176_chunk.device, _hyper_1_176_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_177_chunk."time")), _hyper_1_177_chunk.device, PARTIAL avg(_hyper_1_177_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_177_chunk."time"), _hyper_1_177_chunk.device + Output: _hyper_1_176_chunk."time", _hyper_1_176_chunk.temp, _hyper_1_176_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_177_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_177_chunk."time"), _hyper_1_177_chunk.device, _hyper_1_177_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 min'::interval, _hyper_1_178_chunk."time")), _hyper_1_178_chunk.device, PARTIAL avg(_hyper_1_178_chunk.temp) - Group Key: time_bucket('@ 1 min'::interval, _hyper_1_178_chunk."time"), _hyper_1_178_chunk.device + Output: _hyper_1_177_chunk."time", _hyper_1_177_chunk.temp, _hyper_1_177_chunk.device -> Seq Scan on _timescaledb_internal._hyper_1_178_chunk - Output: time_bucket('@ 1 min'::interval, _hyper_1_178_chunk."time"), _hyper_1_178_chunk.device, _hyper_1_178_chunk.temp -(898 rows) + Output: _hyper_1_178_chunk."time", _hyper_1_178_chunk.temp, _hyper_1_178_chunk.device +(366 rows) INSERT INTO many_partitions_test_1m(time, temp, device) SELECT time_bucket('1 minute', time) AS period, avg(temp), device diff --git a/test/expected/parallel-14.out b/test/expected/parallel-14.out index 803211f48f8..40a80e2f52a 100644 --- a/test/expected/parallel-14.out +++ b/test/expected/parallel-14.out @@ -70,23 +70,21 @@ FROM "test" GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------------------- - Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> Finalize HashAggregate - Group Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> Gather - Workers Planned: 2 - -> Parallel Append - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Parallel Seq Scan on _hyper_1_1_chunk - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) - -> Parallel Seq Scan on _hyper_1_2_chunk -(14 rows) + QUERY PLAN +-------------------------------------------------------------------------------------- + Gather + Workers Planned: 1 + Single Copy: true + -> Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Result + -> Append + -> Seq Scan on _hyper_1_1_chunk + -> Seq Scan on _hyper_1_2_chunk +(12 rows) -- test single copy parallel plan with parallel chunk append :PREFIX SELECT time_bucket('1 second', ts) sec, last(i, j) @@ -95,30 +93,27 @@ WHERE length(version()) > 0 GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------------------------- - Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> Finalize HashAggregate - Group Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> Gather - Workers Planned: 2 + QUERY PLAN +-------------------------------------------------------------------------------- + Gather + Workers Planned: 1 + Single Copy: true + -> Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, test.ts) -> Result One-Time Filter: (length(version()) > 0) - -> Parallel Custom Scan (ChunkAppend) on test + -> Custom Scan (ChunkAppend) on test Chunks excluded during startup: 0 - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Result - One-Time Filter: (length(version()) > 0) - -> Parallel Seq Scan on _hyper_1_1_chunk - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) - -> Result - One-Time Filter: (length(version()) > 0) - -> Parallel Seq Scan on _hyper_1_2_chunk -(21 rows) + -> Result + One-Time Filter: (length(version()) > 0) + -> Seq Scan on _hyper_1_1_chunk + -> Result + One-Time Filter: (length(version()) > 0) + -> Seq Scan on _hyper_1_2_chunk +(18 rows) SELECT time_bucket('1 second', ts) sec, last(i, j) FROM "test" diff --git a/test/expected/parallel-15.out b/test/expected/parallel-15.out index 803211f48f8..250282199c4 100644 --- a/test/expected/parallel-15.out +++ b/test/expected/parallel-15.out @@ -70,23 +70,21 @@ FROM "test" GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------------------- - Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> Finalize HashAggregate - Group Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> Gather - Workers Planned: 2 - -> Parallel Append - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Parallel Seq Scan on _hyper_1_1_chunk - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) - -> Parallel Seq Scan on _hyper_1_2_chunk -(14 rows) + QUERY PLAN +-------------------------------------------------------------------------------------- + Gather + Workers Planned: 1 + Single Copy: true + -> Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Result + -> Append + -> Seq Scan on _hyper_1_1_chunk + -> Seq Scan on _hyper_1_2_chunk +(12 rows) -- test single copy parallel plan with parallel chunk append :PREFIX SELECT time_bucket('1 second', ts) sec, last(i, j) @@ -95,30 +93,28 @@ WHERE length(version()) > 0 GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------------------------- - Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> Finalize HashAggregate - Group Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> Gather - Workers Planned: 2 + QUERY PLAN +-------------------------------------------------------------------------------------- + Gather + Workers Planned: 1 + Single Copy: true + -> Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, test.ts) -> Result - One-Time Filter: (length(version()) > 0) - -> Parallel Custom Scan (ChunkAppend) on test - Chunks excluded during startup: 0 - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Result + One-Time Filter: (length(version()) > 0) + -> Custom Scan (ChunkAppend) on test + Chunks excluded during startup: 0 -> Result One-Time Filter: (length(version()) > 0) - -> Parallel Seq Scan on _hyper_1_1_chunk - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) + -> Seq Scan on _hyper_1_1_chunk -> Result One-Time Filter: (length(version()) > 0) - -> Parallel Seq Scan on _hyper_1_2_chunk -(21 rows) + -> Seq Scan on _hyper_1_2_chunk +(19 rows) SELECT time_bucket('1 second', ts) sec, last(i, j) FROM "test" diff --git a/test/expected/parallel-16.out b/test/expected/parallel-16.out index 0d393043ac1..1e1f73815a9 100644 --- a/test/expected/parallel-16.out +++ b/test/expected/parallel-16.out @@ -70,23 +70,21 @@ FROM "test" GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------------------- - Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> Finalize HashAggregate - Group Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) - -> Gather - Workers Planned: 2 - -> Parallel Append - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) - -> Parallel Seq Scan on _hyper_1_1_chunk - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) - -> Parallel Seq Scan on _hyper_1_2_chunk -(14 rows) + QUERY PLAN +-------------------------------------------------------------------------------------- + Gather + Workers Planned: 1 + Single Copy: true + -> Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts)) + -> HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Result + -> Append + -> Seq Scan on _hyper_1_1_chunk + -> Seq Scan on _hyper_1_2_chunk +(12 rows) -- test single copy parallel plan with parallel chunk append :PREFIX SELECT time_bucket('1 second', ts) sec, last(i, j) @@ -95,30 +93,28 @@ WHERE length(version()) > 0 GROUP BY sec ORDER BY sec LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------------------------------------- - Limit - -> Sort - Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> Finalize HashAggregate - Group Key: (time_bucket('@ 1 sec'::interval, test.ts)) - -> Gather - Workers Planned: 2 + QUERY PLAN +-------------------------------------------------------------------------------------- + Gather + Workers Planned: 1 + Single Copy: true + -> Limit + -> Sort + Sort Key: (time_bucket('@ 1 sec'::interval, test.ts)) + -> HashAggregate + Group Key: time_bucket('@ 1 sec'::interval, test.ts) -> Result - One-Time Filter: (length(version()) > 0) - -> Parallel Custom Scan (ChunkAppend) on test - Chunks excluded during startup: 0 - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_1_chunk.ts) + -> Result + One-Time Filter: (length(version()) > 0) + -> Custom Scan (ChunkAppend) on test + Chunks excluded during startup: 0 -> Result One-Time Filter: (length(version()) > 0) - -> Parallel Seq Scan on _hyper_1_1_chunk - -> Partial HashAggregate - Group Key: time_bucket('@ 1 sec'::interval, _hyper_1_2_chunk.ts) + -> Seq Scan on _hyper_1_1_chunk -> Result One-Time Filter: (length(version()) > 0) - -> Parallel Seq Scan on _hyper_1_2_chunk -(21 rows) + -> Seq Scan on _hyper_1_2_chunk +(19 rows) SELECT time_bucket('1 second', ts) sec, last(i, j) FROM "test" diff --git a/test/expected/partitionwise-14.out b/test/expected/partitionwise-14.out index a2de3e4994a..7baadd6c26b 100644 --- a/test/expected/partitionwise-14.out +++ b/test/expected/partitionwise-14.out @@ -416,74 +416,55 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) --- Partial aggregation pushdown when a projection is used in the path. +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) -- Also test time_bucket SET timescaledb.enable_chunkwise_aggregation = 'off'; @@ -519,36 +500,26 @@ SELECT time_bucket('1 month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Sort Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) -- Test partitionwise joins, mostly to see that we do not break -- anything @@ -810,58 +781,55 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - -> Sort - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Finalize HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, PARTIAL avg(_hyper_3_7_chunk.temp) - Group Key: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk - Output: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - -> Partial HashAggregate - Output: (time_func(_hyper_3_8_chunk."time")), _hyper_3_8_chunk.device, PARTIAL avg(_hyper_3_8_chunk.temp) - Group Key: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk - Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp -(19 rows) - --- Partial aggregation pushdown when a projection is used in the path. + -> GroupAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Incremental Sort + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + Presorted Key: (time_func(_hyper_3_7_chunk."time")) + -> Result + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + -> Merge Append + Sort Key: (time_func(_hyper_3_7_chunk."time")) + -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk + Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") + -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk + Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") +(17 rows) + +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - -> Sort - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Finalize HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Append - -> Partial HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), PARTIAL avg(_hyper_3_7_chunk.temp) - Group Key: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device) - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk - Output: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp - -> Partial HashAggregate - Output: (time_func(_hyper_3_8_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device)), PARTIAL avg(_hyper_3_8_chunk.temp) - Group Key: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device) - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk - Output: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device), _hyper_3_8_chunk.temp -(19 rows) + -> GroupAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Incremental Sort + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), _hyper_3_7_chunk.temp + Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + Presorted Key: (time_func(_hyper_3_7_chunk."time")) + -> Result + Output: (time_func(_hyper_3_7_chunk."time")), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp + -> Merge Append + Sort Key: (time_func(_hyper_3_7_chunk."time")) + -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk + Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") + -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk + Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") +(17 rows) -- Test removal of redundant group key optimization in PG16 -- All lower versions include the redundant key on device column diff --git a/test/expected/partitionwise-15.out b/test/expected/partitionwise-15.out index a2de3e4994a..7baadd6c26b 100644 --- a/test/expected/partitionwise-15.out +++ b/test/expected/partitionwise-15.out @@ -416,74 +416,55 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) --- Partial aggregation pushdown when a projection is used in the path. +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) -- Also test time_bucket SET timescaledb.enable_chunkwise_aggregation = 'off'; @@ -519,36 +500,26 @@ SELECT time_bucket('1 month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Sort Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) -- Test partitionwise joins, mostly to see that we do not break -- anything @@ -810,58 +781,55 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - -> Sort - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Finalize HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, PARTIAL avg(_hyper_3_7_chunk.temp) - Group Key: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk - Output: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - -> Partial HashAggregate - Output: (time_func(_hyper_3_8_chunk."time")), _hyper_3_8_chunk.device, PARTIAL avg(_hyper_3_8_chunk.temp) - Group Key: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk - Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp -(19 rows) - --- Partial aggregation pushdown when a projection is used in the path. + -> GroupAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Incremental Sort + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + Presorted Key: (time_func(_hyper_3_7_chunk."time")) + -> Result + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + -> Merge Append + Sort Key: (time_func(_hyper_3_7_chunk."time")) + -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk + Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") + -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk + Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") +(17 rows) + +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - -> Sort - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Finalize HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Append - -> Partial HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), PARTIAL avg(_hyper_3_7_chunk.temp) - Group Key: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device) - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk - Output: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp - -> Partial HashAggregate - Output: (time_func(_hyper_3_8_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device)), PARTIAL avg(_hyper_3_8_chunk.temp) - Group Key: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device) - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk - Output: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device), _hyper_3_8_chunk.temp -(19 rows) + -> GroupAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Incremental Sort + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), _hyper_3_7_chunk.temp + Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + Presorted Key: (time_func(_hyper_3_7_chunk."time")) + -> Result + Output: (time_func(_hyper_3_7_chunk."time")), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp + -> Merge Append + Sort Key: (time_func(_hyper_3_7_chunk."time")) + -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk + Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") + -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk + Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") +(17 rows) -- Test removal of redundant group key optimization in PG16 -- All lower versions include the redundant key on device column diff --git a/test/expected/partitionwise-16.out b/test/expected/partitionwise-16.out index 3242efaf458..d1ad799cbf7 100644 --- a/test/expected/partitionwise-16.out +++ b/test/expected/partitionwise-16.out @@ -416,74 +416,55 @@ SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) --- Partial aggregation pushdown when a projection is used in the path. +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------- Sort Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: date_trunc('month'::text, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: date_trunc('month'::text, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: date_trunc('month'::text, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (date_trunc('month'::text, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: date_trunc('month'::text, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) -- Also test time_bucket SET timescaledb.enable_chunkwise_aggregation = 'off'; @@ -519,36 +500,26 @@ SELECT time_bucket('1 month', time), device, avg(temp) FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- Sort Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, (avg(_hyper_1_1_chunk.temp)) Sort Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Finalize HashAggregate + -> HashAggregate Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, avg(_hyper_1_1_chunk.temp) - Group Key: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time")), _hyper_1_1_chunk.device, PARTIAL avg(_hyper_1_1_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device + -> Result + Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_1_chunk."time"), _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time")), _hyper_1_2_chunk.device, PARTIAL avg(_hyper_1_2_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device + Output: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device, _hyper_1_1_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_2_chunk."time"), _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time")), _hyper_1_3_chunk.device, PARTIAL avg(_hyper_1_3_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device + Output: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device, _hyper_1_2_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_3_chunk."time"), _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp - -> Partial HashAggregate - Output: (time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time")), _hyper_1_4_chunk.device, PARTIAL avg(_hyper_1_4_chunk.temp) - Group Key: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device + Output: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device, _hyper_1_3_chunk.temp -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: time_bucket('@ 1 mon'::interval, _hyper_1_4_chunk."time"), _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp -(27 rows) + Output: _hyper_1_4_chunk."time", _hyper_1_4_chunk.device, _hyper_1_4_chunk.temp +(17 rows) -- Test partitionwise joins, mostly to see that we do not break -- anything @@ -810,58 +781,55 @@ FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - -> Sort - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, (avg(_hyper_3_7_chunk.temp)) - Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Finalize HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device - -> Append - -> Partial HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, PARTIAL avg(_hyper_3_7_chunk.temp) - Group Key: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk - Output: time_func(_hyper_3_7_chunk."time"), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp - -> Partial HashAggregate - Output: (time_func(_hyper_3_8_chunk."time")), _hyper_3_8_chunk.device, PARTIAL avg(_hyper_3_8_chunk.temp) - Group Key: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk - Output: time_func(_hyper_3_8_chunk."time"), _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp -(19 rows) - --- Partial aggregation pushdown when a projection is used in the path. + -> GroupAggregate + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + -> Incremental Sort + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + Sort Key: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device + Presorted Key: (time_func(_hyper_3_7_chunk."time")) + -> Result + Output: (time_func(_hyper_3_7_chunk."time")), _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp + -> Merge Append + Sort Key: (time_func(_hyper_3_7_chunk."time")) + -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk + Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") + -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk + Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") +(17 rows) + +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - -> Sort - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), (avg(_hyper_3_7_chunk.temp)) - Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Finalize HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) - Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) - -> Append - -> Partial HashAggregate - Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), PARTIAL avg(_hyper_3_7_chunk.temp) - Group Key: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device) - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk - Output: time_func(_hyper_3_7_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp - -> Partial HashAggregate - Output: (time_func(_hyper_3_8_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device)), PARTIAL avg(_hyper_3_8_chunk.temp) - Group Key: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device) - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk - Output: time_func(_hyper_3_8_chunk."time"), _timescaledb_functions.get_partition_hash(_hyper_3_8_chunk.device), _hyper_3_8_chunk.temp -(19 rows) + -> GroupAggregate + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), avg(_hyper_3_7_chunk.temp) + Group Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + -> Incremental Sort + Output: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)), _hyper_3_7_chunk.temp + Sort Key: (time_func(_hyper_3_7_chunk."time")), (_timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device)) + Presorted Key: (time_func(_hyper_3_7_chunk."time")) + -> Result + Output: (time_func(_hyper_3_7_chunk."time")), _timescaledb_functions.get_partition_hash(_hyper_3_7_chunk.device), _hyper_3_7_chunk.temp + -> Merge Append + Sort Key: (time_func(_hyper_3_7_chunk."time")) + -> Index Scan Backward using _hyper_3_7_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_7_chunk + Output: _hyper_3_7_chunk."time", _hyper_3_7_chunk.device, _hyper_3_7_chunk.temp, time_func(_hyper_3_7_chunk."time") + -> Index Scan Backward using _hyper_3_8_chunk_hyper_timepart_expr_idx on _timescaledb_internal._hyper_3_8_chunk + Output: _hyper_3_8_chunk."time", _hyper_3_8_chunk.device, _hyper_3_8_chunk.temp, time_func(_hyper_3_8_chunk."time") +(17 rows) -- Test removal of redundant group key optimization in PG16 -- All lower versions include the redundant key on device column diff --git a/test/expected/query-14.out b/test/expected/query-14.out index 0faea17ad7a..2289eabfa05 100644 --- a/test/expected/query-14.out +++ b/test/expected/query-14.out @@ -150,54 +150,28 @@ SHOW timescaledb.enable_optimizations; (5 rows) :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_date GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC - -> Finalize HashAggregate - Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) - -> Append - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_6_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_7_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_7_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_8_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_8_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_9_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_9_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_10_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_10_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_11_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_11_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_12_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_12_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_13_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_13_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_14_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_14_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_15_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_15_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_16_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_16_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_17_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_17_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_18_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_18_chunk -(45 rows) + -> GroupAggregate + Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) + -> Result + -> Merge Append + Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC + -> Index Scan using _hyper_4_6_chunk_time_plain_date on _hyper_4_6_chunk + -> Index Scan using _hyper_4_7_chunk_time_plain_date on _hyper_4_7_chunk + -> Index Scan using _hyper_4_8_chunk_time_plain_date on _hyper_4_8_chunk + -> Index Scan using _hyper_4_9_chunk_time_plain_date on _hyper_4_9_chunk + -> Index Scan using _hyper_4_10_chunk_time_plain_date on _hyper_4_10_chunk + -> Index Scan using _hyper_4_11_chunk_time_plain_date on _hyper_4_11_chunk + -> Index Scan using _hyper_4_12_chunk_time_plain_date on _hyper_4_12_chunk + -> Index Scan using _hyper_4_13_chunk_time_plain_date on _hyper_4_13_chunk + -> Index Scan using _hyper_4_14_chunk_time_plain_date on _hyper_4_14_chunk + -> Index Scan using _hyper_4_15_chunk_time_plain_date on _hyper_4_15_chunk + -> Index Scan using _hyper_4_16_chunk_time_plain_date on _hyper_4_16_chunk + -> Index Scan using _hyper_4_17_chunk_time_plain_date on _hyper_4_17_chunk + -> Index Scan using _hyper_4_18_chunk_time_plain_date on _hyper_4_18_chunk +(19 rows) --the minute and second results should be diff :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2; @@ -359,43 +333,31 @@ BEGIN; :PREFIX SELECT time_bucket(10, time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------- Limit - -> Finalize GroupAggregate + -> GroupAggregate Group Key: (time_bucket(10, hyper_1_int."time")) -> Custom Scan (ChunkAppend) on hyper_1_int Order: time_bucket(10, hyper_1_int."time") DESC - -> Partial GroupAggregate - Group Key: time_bucket(10, _hyper_3_5_chunk."time") - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Partial GroupAggregate - Group Key: time_bucket(10, _hyper_3_4_chunk."time") - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Partial GroupAggregate - Group Key: time_bucket(10, _hyper_3_3_chunk."time") - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(14 rows) + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(8 rows) :PREFIX SELECT time_bucket(10, time, 2) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------- Limit - -> Finalize GroupAggregate + -> GroupAggregate Group Key: (time_bucket(10, hyper_1_int."time", 2)) -> Custom Scan (ChunkAppend) on hyper_1_int Order: time_bucket(10, hyper_1_int."time", 2) DESC - -> Partial GroupAggregate - Group Key: time_bucket(10, _hyper_3_5_chunk."time", 2) - -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk - -> Partial GroupAggregate - Group Key: time_bucket(10, _hyper_3_4_chunk."time", 2) - -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk - -> Partial GroupAggregate - Group Key: time_bucket(10, _hyper_3_3_chunk."time", 2) - -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk -(14 rows) + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(8 rows) ROLLBACK; -- sort order optimization should not be applied to non-hypertables diff --git a/test/expected/query-15.out b/test/expected/query-15.out index 8447ecba3bd..418da001ea4 100644 --- a/test/expected/query-15.out +++ b/test/expected/query-15.out @@ -150,54 +150,28 @@ SHOW timescaledb.enable_optimizations; (5 rows) :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_date GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC - -> Finalize HashAggregate - Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) - -> Append - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_6_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_7_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_7_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_8_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_8_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_9_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_9_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_10_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_10_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_11_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_11_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_12_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_12_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_13_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_13_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_14_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_14_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_15_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_15_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_16_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_16_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_17_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_17_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_18_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_18_chunk -(45 rows) + -> GroupAggregate + Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) + -> Result + -> Merge Append + Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC + -> Index Scan using _hyper_4_6_chunk_time_plain_date on _hyper_4_6_chunk + -> Index Scan using _hyper_4_7_chunk_time_plain_date on _hyper_4_7_chunk + -> Index Scan using _hyper_4_8_chunk_time_plain_date on _hyper_4_8_chunk + -> Index Scan using _hyper_4_9_chunk_time_plain_date on _hyper_4_9_chunk + -> Index Scan using _hyper_4_10_chunk_time_plain_date on _hyper_4_10_chunk + -> Index Scan using _hyper_4_11_chunk_time_plain_date on _hyper_4_11_chunk + -> Index Scan using _hyper_4_12_chunk_time_plain_date on _hyper_4_12_chunk + -> Index Scan using _hyper_4_13_chunk_time_plain_date on _hyper_4_13_chunk + -> Index Scan using _hyper_4_14_chunk_time_plain_date on _hyper_4_14_chunk + -> Index Scan using _hyper_4_15_chunk_time_plain_date on _hyper_4_15_chunk + -> Index Scan using _hyper_4_16_chunk_time_plain_date on _hyper_4_16_chunk + -> Index Scan using _hyper_4_17_chunk_time_plain_date on _hyper_4_17_chunk + -> Index Scan using _hyper_4_18_chunk_time_plain_date on _hyper_4_18_chunk +(19 rows) --the minute and second results should be diff :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2; @@ -360,45 +334,33 @@ BEGIN; :PREFIX SELECT time_bucket(10, time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN -------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (time_bucket(10, _hyper_3_5_chunk."time")) DESC - -> Finalize HashAggregate - Group Key: (time_bucket(10, _hyper_3_5_chunk."time")) - -> Append - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_5_chunk."time") - -> Seq Scan on _hyper_3_5_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_4_chunk."time") - -> Seq Scan on _hyper_3_4_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_3_chunk."time") - -> Seq Scan on _hyper_3_3_chunk -(15 rows) + -> GroupAggregate + Group Key: (time_bucket(10, hyper_1_int."time")) + -> Result + -> Custom Scan (ChunkAppend) on hyper_1_int + Order: time_bucket(10, hyper_1_int."time") DESC + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(9 rows) :PREFIX SELECT time_bucket(10, time, 2) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) DESC - -> Finalize HashAggregate - Group Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) - -> Append - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_5_chunk."time", 2) - -> Seq Scan on _hyper_3_5_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_4_chunk."time", 2) - -> Seq Scan on _hyper_3_4_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_3_chunk."time", 2) - -> Seq Scan on _hyper_3_3_chunk -(15 rows) + -> GroupAggregate + Group Key: (time_bucket(10, hyper_1_int."time", 2)) + -> Result + -> Custom Scan (ChunkAppend) on hyper_1_int + Order: time_bucket(10, hyper_1_int."time", 2) DESC + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(9 rows) ROLLBACK; -- sort order optimization should not be applied to non-hypertables diff --git a/test/expected/query-16.out b/test/expected/query-16.out index 8447ecba3bd..418da001ea4 100644 --- a/test/expected/query-16.out +++ b/test/expected/query-16.out @@ -150,54 +150,28 @@ SHOW timescaledb.enable_optimizations; (5 rows) :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_date GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC - -> Finalize HashAggregate - Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) - -> Append - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_6_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_7_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_7_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_8_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_8_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_9_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_9_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_10_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_10_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_11_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_11_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_12_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_12_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_13_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_13_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_14_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_14_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_15_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_15_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_16_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_16_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_17_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_17_chunk - -> Partial HashAggregate - Group Key: date_trunc('minute'::text, (_hyper_4_18_chunk."time")::timestamp with time zone) - -> Seq Scan on _hyper_4_18_chunk -(45 rows) + -> GroupAggregate + Group Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) + -> Result + -> Merge Append + Sort Key: (date_trunc('minute'::text, (_hyper_4_6_chunk."time")::timestamp with time zone)) DESC + -> Index Scan using _hyper_4_6_chunk_time_plain_date on _hyper_4_6_chunk + -> Index Scan using _hyper_4_7_chunk_time_plain_date on _hyper_4_7_chunk + -> Index Scan using _hyper_4_8_chunk_time_plain_date on _hyper_4_8_chunk + -> Index Scan using _hyper_4_9_chunk_time_plain_date on _hyper_4_9_chunk + -> Index Scan using _hyper_4_10_chunk_time_plain_date on _hyper_4_10_chunk + -> Index Scan using _hyper_4_11_chunk_time_plain_date on _hyper_4_11_chunk + -> Index Scan using _hyper_4_12_chunk_time_plain_date on _hyper_4_12_chunk + -> Index Scan using _hyper_4_13_chunk_time_plain_date on _hyper_4_13_chunk + -> Index Scan using _hyper_4_14_chunk_time_plain_date on _hyper_4_14_chunk + -> Index Scan using _hyper_4_15_chunk_time_plain_date on _hyper_4_15_chunk + -> Index Scan using _hyper_4_16_chunk_time_plain_date on _hyper_4_16_chunk + -> Index Scan using _hyper_4_17_chunk_time_plain_date on _hyper_4_17_chunk + -> Index Scan using _hyper_4_18_chunk_time_plain_date on _hyper_4_18_chunk +(19 rows) --the minute and second results should be diff :PREFIX SELECT date_trunc('minute', time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1 GROUP BY t ORDER BY t DESC limit 2; @@ -360,45 +334,33 @@ BEGIN; :PREFIX SELECT time_bucket(10, time) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN -------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (time_bucket(10, _hyper_3_5_chunk."time")) DESC - -> Finalize HashAggregate - Group Key: (time_bucket(10, _hyper_3_5_chunk."time")) - -> Append - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_5_chunk."time") - -> Seq Scan on _hyper_3_5_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_4_chunk."time") - -> Seq Scan on _hyper_3_4_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_3_chunk."time") - -> Seq Scan on _hyper_3_3_chunk -(15 rows) + -> GroupAggregate + Group Key: (time_bucket(10, hyper_1_int."time")) + -> Result + -> Custom Scan (ChunkAppend) on hyper_1_int + Order: time_bucket(10, hyper_1_int."time") DESC + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(9 rows) :PREFIX SELECT time_bucket(10, time, 2) t, avg(series_0), min(series_1), avg(series_2) FROM hyper_1_int GROUP BY t ORDER BY t DESC limit 2; - QUERY PLAN ----------------------------------------------------------------------------------- + QUERY PLAN +---------------------------------------------------------------------------------------------- Limit - -> Sort - Sort Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) DESC - -> Finalize HashAggregate - Group Key: (time_bucket(10, _hyper_3_5_chunk."time", 2)) - -> Append - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_5_chunk."time", 2) - -> Seq Scan on _hyper_3_5_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_4_chunk."time", 2) - -> Seq Scan on _hyper_3_4_chunk - -> Partial HashAggregate - Group Key: time_bucket(10, _hyper_3_3_chunk."time", 2) - -> Seq Scan on _hyper_3_3_chunk -(15 rows) + -> GroupAggregate + Group Key: (time_bucket(10, hyper_1_int."time", 2)) + -> Result + -> Custom Scan (ChunkAppend) on hyper_1_int + Order: time_bucket(10, hyper_1_int."time", 2) DESC + -> Index Scan using _hyper_3_5_chunk_time_plain_int on _hyper_3_5_chunk + -> Index Scan using _hyper_3_4_chunk_time_plain_int on _hyper_3_4_chunk + -> Index Scan using _hyper_3_3_chunk_time_plain_int on _hyper_3_3_chunk +(9 rows) ROLLBACK; -- sort order optimization should not be applied to non-hypertables diff --git a/test/expected/sql_query.out b/test/expected/sql_query.out index a97fb79cbc7..26f9ef07d69 100644 --- a/test/expected/sql_query.out +++ b/test/expected/sql_query.out @@ -247,70 +247,50 @@ EXPLAIN (verbose ON, costs off)SELECT "timeCustom" t, min(series_0) FROM PUBLIC. --The query should still use the index on timeCustom, even though the GROUP BY/ORDER BY is on the transformed time 't'. --However, current query plans show that it does not. EXPLAIN (verbose ON, costs off)SELECT "timeCustom"/10 t, min(series_0) FROM PUBLIC."two_Partitions" GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------- Limit Output: ((_hyper_1_1_chunk."timeCustom" / 10)), (min(_hyper_1_1_chunk.series_0)) -> Sort Output: ((_hyper_1_1_chunk."timeCustom" / 10)), (min(_hyper_1_1_chunk.series_0)) Sort Key: ((_hyper_1_1_chunk."timeCustom" / 10)) DESC NULLS LAST - -> Finalize HashAggregate + -> HashAggregate Output: ((_hyper_1_1_chunk."timeCustom" / 10)), min(_hyper_1_1_chunk.series_0) - Group Key: ((_hyper_1_1_chunk."timeCustom" / 10)) - -> Append - -> Partial HashAggregate - Output: ((_hyper_1_1_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_1_chunk.series_0) - Group Key: (_hyper_1_1_chunk."timeCustom" / 10) + Group Key: (_hyper_1_1_chunk."timeCustom" / 10) + -> Result + Output: (_hyper_1_1_chunk."timeCustom" / 10), _hyper_1_1_chunk.series_0 + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: (_hyper_1_1_chunk."timeCustom" / 10), _hyper_1_1_chunk.series_0 - -> Partial HashAggregate - Output: ((_hyper_1_2_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_2_chunk.series_0) - Group Key: (_hyper_1_2_chunk."timeCustom" / 10) + Output: _hyper_1_1_chunk."timeCustom", _hyper_1_1_chunk.series_0 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: (_hyper_1_2_chunk."timeCustom" / 10), _hyper_1_2_chunk.series_0 - -> Partial HashAggregate - Output: ((_hyper_1_3_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_3_chunk.series_0) - Group Key: (_hyper_1_3_chunk."timeCustom" / 10) + Output: _hyper_1_2_chunk."timeCustom", _hyper_1_2_chunk.series_0 -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: (_hyper_1_3_chunk."timeCustom" / 10), _hyper_1_3_chunk.series_0 - -> Partial HashAggregate - Output: ((_hyper_1_4_chunk."timeCustom" / 10)), PARTIAL min(_hyper_1_4_chunk.series_0) - Group Key: (_hyper_1_4_chunk."timeCustom" / 10) + Output: _hyper_1_3_chunk."timeCustom", _hyper_1_3_chunk.series_0 -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: (_hyper_1_4_chunk."timeCustom" / 10), _hyper_1_4_chunk.series_0 -(29 rows) + Output: _hyper_1_4_chunk."timeCustom", _hyper_1_4_chunk.series_0 +(19 rows) EXPLAIN (verbose ON, costs off)SELECT "timeCustom"%10 t, min(series_0) FROM PUBLIC."two_Partitions" GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------- Limit Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), (min(_hyper_1_1_chunk.series_0)) -> Sort Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), (min(_hyper_1_1_chunk.series_0)) Sort Key: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)) DESC NULLS LAST - -> Finalize HashAggregate + -> HashAggregate Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), min(_hyper_1_1_chunk.series_0) - Group Key: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)) - -> Append - -> Partial HashAggregate - Output: ((_hyper_1_1_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_1_chunk.series_0) - Group Key: (_hyper_1_1_chunk."timeCustom" % '10'::bigint) + Group Key: (_hyper_1_1_chunk."timeCustom" % '10'::bigint) + -> Result + Output: (_hyper_1_1_chunk."timeCustom" % '10'::bigint), _hyper_1_1_chunk.series_0 + -> Append -> Seq Scan on _timescaledb_internal._hyper_1_1_chunk - Output: (_hyper_1_1_chunk."timeCustom" % '10'::bigint), _hyper_1_1_chunk.series_0 - -> Partial HashAggregate - Output: ((_hyper_1_2_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_2_chunk.series_0) - Group Key: (_hyper_1_2_chunk."timeCustom" % '10'::bigint) + Output: _hyper_1_1_chunk."timeCustom", _hyper_1_1_chunk.series_0 -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk - Output: (_hyper_1_2_chunk."timeCustom" % '10'::bigint), _hyper_1_2_chunk.series_0 - -> Partial HashAggregate - Output: ((_hyper_1_3_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_3_chunk.series_0) - Group Key: (_hyper_1_3_chunk."timeCustom" % '10'::bigint) + Output: _hyper_1_2_chunk."timeCustom", _hyper_1_2_chunk.series_0 -> Seq Scan on _timescaledb_internal._hyper_1_3_chunk - Output: (_hyper_1_3_chunk."timeCustom" % '10'::bigint), _hyper_1_3_chunk.series_0 - -> Partial HashAggregate - Output: ((_hyper_1_4_chunk."timeCustom" % '10'::bigint)), PARTIAL min(_hyper_1_4_chunk.series_0) - Group Key: (_hyper_1_4_chunk."timeCustom" % '10'::bigint) + Output: _hyper_1_3_chunk."timeCustom", _hyper_1_3_chunk.series_0 -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: (_hyper_1_4_chunk."timeCustom" % '10'::bigint), _hyper_1_4_chunk.series_0 -(29 rows) + Output: _hyper_1_4_chunk."timeCustom", _hyper_1_4_chunk.series_0 +(19 rows) diff --git a/test/sql/partitionwise.sql.in b/test/sql/partitionwise.sql.in index 6fc5854d8dd..3f56154cc6e 100644 --- a/test/sql/partitionwise.sql.in +++ b/test/sql/partitionwise.sql.in @@ -152,7 +152,8 @@ FROM hyper GROUP BY 1, 2 ORDER BY 1, 2; --- Partial aggregation pushdown when a projection is used in the path. +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. SET enable_partitionwise_aggregate = 'on'; :PREFIX SELECT date_trunc('month', time), device, avg(temp) @@ -264,7 +265,8 @@ GROUP BY 1, 2 ORDER BY 1, 2 LIMIT 10; --- Partial aggregation pushdown when a projection is used in the path. +-- Partial aggregation pushdown is currently not supported for this query by +-- the TSDB pushdown code since a projection is used in the path. :PREFIX SELECT time_func(time), _timescaledb_functions.get_partition_hash(device), avg(temp) FROM hyper_timepart diff --git a/test/sql/updates/setup.continuous_aggs.sql b/test/sql/updates/setup.continuous_aggs.sql index db2b7e3f4f9..6efd9418d9d 100644 --- a/test/sql/updates/setup.continuous_aggs.sql +++ b/test/sql/updates/setup.continuous_aggs.sql @@ -11,12 +11,6 @@ -- on timescaledb 1.7.x CALL _timescaledb_testing.stop_workers(); --- disable chunkwise aggregation and hash aggregation, because it might lead to --- different order of chunk creation in the cagg table, based on the underlying --- aggregation plan. -SET timescaledb.enable_chunkwise_aggregation TO OFF; -SET enable_hashagg TO OFF; - CREATE TYPE custom_type AS (high int, low int); CREATE TABLE conditions_before ( @@ -298,6 +292,3 @@ SELECT add_continuous_aggregate_policy('mat_drop', '7 days', '-30 days'::interva CALL refresh_continuous_aggregate('mat_drop',NULL,NULL); SELECT drop_chunks('drop_test', NOW() - INTERVAL '7 days'); - -RESET timescaledb.enable_chunkwise_aggregation; -RESET enable_hashagg; From bc72b3dbe01efbb60cb26a3e500a068a2c8d5d30 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 21:01:30 +0200 Subject: [PATCH 098/157] lost update test changes --- test/sql/updates/post.pg_upgrade.sql | 2 -- test/sql/updates/setup.continuous_aggs.sql | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/sql/updates/post.pg_upgrade.sql b/test/sql/updates/post.pg_upgrade.sql index 2fbdcf7d228..83f49390e4f 100644 --- a/test/sql/updates/post.pg_upgrade.sql +++ b/test/sql/updates/post.pg_upgrade.sql @@ -8,5 +8,3 @@ \ir post.catalog.sql \ir post.policies.sql \ir post.functions.sql - -SELECT * FROM cagg_join.measurement_daily ORDER BY 1, 2, 3, 4, 5, 6; diff --git a/test/sql/updates/setup.continuous_aggs.sql b/test/sql/updates/setup.continuous_aggs.sql index 6efd9418d9d..db2b7e3f4f9 100644 --- a/test/sql/updates/setup.continuous_aggs.sql +++ b/test/sql/updates/setup.continuous_aggs.sql @@ -11,6 +11,12 @@ -- on timescaledb 1.7.x CALL _timescaledb_testing.stop_workers(); +-- disable chunkwise aggregation and hash aggregation, because it might lead to +-- different order of chunk creation in the cagg table, based on the underlying +-- aggregation plan. +SET timescaledb.enable_chunkwise_aggregation TO OFF; +SET enable_hashagg TO OFF; + CREATE TYPE custom_type AS (high int, low int); CREATE TABLE conditions_before ( @@ -292,3 +298,6 @@ SELECT add_continuous_aggregate_policy('mat_drop', '7 days', '-30 days'::interva CALL refresh_continuous_aggregate('mat_drop',NULL,NULL); SELECT drop_chunks('drop_test', NOW() - INTERVAL '7 days'); + +RESET timescaledb.enable_chunkwise_aggregation; +RESET enable_hashagg; From 5020c49745c832f763e2396154f058f1e9baacc8 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:01:20 +0200 Subject: [PATCH 099/157] remove projection --- tsl/src/chunkwise_agg.c | 20 ++++- .../nodes/decompress_chunk/decompress_chunk.c | 2 +- .../nodes/decompress_chunk/decompress_chunk.h | 2 + .../expected/transparent_decompression-15.out | 12 ++- tsl/test/expected/vectorized_aggregation.out | 90 ++++++++----------- 5 files changed, 62 insertions(+), 64 deletions(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index 920aeb8d1c2..17f3769b4d1 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -261,9 +261,25 @@ add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, * Note that we cannot use apply_projection_to_path() here, because it might * modify the targetlist of the projection-capable paths in place, which * would cause a mismatch when these paths are used in another context. + * + * In case of DecompressChunk path, we can make a copy of it and push the + * projection down to it. + * + * In general, the projection here arises because the pathtarget of the + * table scans is determined early based on the reltarget which lists all + * used columns in attno order, and the pathtarget before grouping is + * computed by apply_scanjoin_target and has the grouping columns in front. */ - subpath = (Path *) - create_projection_path(root, subpath->parent, subpath, chunk_target_before_grouping); + if (ts_is_decompress_chunk_path(subpath)) + { + subpath = (Path *) copy_decompress_chunk_path((DecompressChunkPath *) subpath); + subpath->pathtarget = chunk_target_before_grouping; + } + else + { + subpath = (Path *) + create_projection_path(root, subpath->parent, subpath, chunk_target_before_grouping); + } if (can_sort) { diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index c9f3be9419e..c67721908e3 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -244,7 +244,7 @@ build_compressed_scan_pathkeys(SortInfo *sort_info, PlannerInfo *root, List *chu sort_info->required_compressed_pathkeys = required_compressed_pathkeys; } -static DecompressChunkPath * +DecompressChunkPath * copy_decompress_chunk_path(DecompressChunkPath *src) { DecompressChunkPath *dst = palloc(sizeof(DecompressChunkPath)); diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.h b/tsl/src/nodes/decompress_chunk/decompress_chunk.h index 0b3cc1e3db9..2d2ad1816b7 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.h +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.h @@ -61,3 +61,5 @@ void ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *rel, Hype Chunk *chunk); extern bool ts_is_decompress_chunk_path(Path *path); + +DecompressChunkPath *copy_decompress_chunk_path(DecompressChunkPath *src); diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index f22b558b1ec..b451cf1d72d 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -9321,18 +9321,16 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v -> Parallel Append -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") - -> Result - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") - -> Result - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_2_chunk."time") -> Parallel Seq Scan on _hyper_1_2_chunk -(18 rows) +(16 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 5dea6de0a71..5736765710e 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -379,8 +379,8 @@ SELECT sum(segment_by_value) FROM testtable WHERE float_value > 0; -- Vectorization not possible due grouping :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.float_value Group Key: _hyper_1_1_chunk.float_value @@ -391,30 +391,24 @@ SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; -> Partial HashAggregate Output: _hyper_1_1_chunk.float_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) Group Key: _hyper_1_1_chunk.float_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.float_value, _hyper_1_1_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Partial HashAggregate Output: _hyper_1_2_chunk.float_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) Group Key: _hyper_1_2_chunk.float_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.float_value, _hyper_1_2_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Partial HashAggregate Output: _hyper_1_3_chunk.float_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) Group Key: _hyper_1_3_chunk.float_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.float_value, _hyper_1_3_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate Output: _hyper_1_4_chunk.float_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) Group Key: _hyper_1_4_chunk.float_value @@ -450,12 +444,12 @@ SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; Group Key: _hyper_1_10_chunk.float_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk Output: _hyper_1_10_chunk.float_value, _hyper_1_10_chunk.segment_by_value -(69 rows) +(63 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.int_value Group Key: _hyper_1_1_chunk.int_value @@ -466,30 +460,24 @@ SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; -> Partial HashAggregate Output: _hyper_1_1_chunk.int_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) Group Key: _hyper_1_1_chunk.int_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Partial HashAggregate Output: _hyper_1_2_chunk.int_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) Group Key: _hyper_1_2_chunk.int_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Partial HashAggregate Output: _hyper_1_3_chunk.int_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) Group Key: _hyper_1_3_chunk.int_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate Output: _hyper_1_4_chunk.int_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) Group Key: _hyper_1_4_chunk.int_value @@ -525,12 +513,12 @@ SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; Group Key: _hyper_1_10_chunk.int_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value -(69 rows) +(63 rows) :EXPLAIN SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.int_value), _hyper_1_1_chunk.segment_by_value Group Key: _hyper_1_1_chunk.segment_by_value @@ -541,30 +529,24 @@ SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; -> Partial HashAggregate Output: _hyper_1_1_chunk.segment_by_value, PARTIAL sum(_hyper_1_1_chunk.int_value) Group Key: _hyper_1_1_chunk.segment_by_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Partial HashAggregate Output: _hyper_1_2_chunk.segment_by_value, PARTIAL sum(_hyper_1_2_chunk.int_value) Group Key: _hyper_1_2_chunk.segment_by_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Partial HashAggregate Output: _hyper_1_3_chunk.segment_by_value, PARTIAL sum(_hyper_1_3_chunk.int_value) Group Key: _hyper_1_3_chunk.segment_by_value - -> Result + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.int_value) Group Key: _hyper_1_4_chunk.segment_by_value @@ -600,7 +582,7 @@ SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; Group Key: _hyper_1_10_chunk.segment_by_value -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value -(69 rows) +(63 rows) -- Vectorization not possible due to two variables and grouping :EXPLAIN From de95e08bf24dbc84cde0b958a1c3a3a3cd13134e Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:02:23 +0200 Subject: [PATCH 100/157] typo --- test/sql/updates/post.pg_upgrade.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/sql/updates/post.pg_upgrade.sql b/test/sql/updates/post.pg_upgrade.sql index 83f49390e4f..2fbdcf7d228 100644 --- a/test/sql/updates/post.pg_upgrade.sql +++ b/test/sql/updates/post.pg_upgrade.sql @@ -8,3 +8,5 @@ \ir post.catalog.sql \ir post.policies.sql \ir post.functions.sql + +SELECT * FROM cagg_join.measurement_daily ORDER BY 1, 2, 3, 4, 5, 6; From 8b1b7112921f177565a538a4038a2ce6774ad11b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:03:13 +0200 Subject: [PATCH 101/157] not sure --- tsl/src/chunkwise_agg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index 17f3769b4d1..3e908f85813 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -268,7 +268,7 @@ add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, * In general, the projection here arises because the pathtarget of the * table scans is determined early based on the reltarget which lists all * used columns in attno order, and the pathtarget before grouping is - * computed by apply_scanjoin_target and has the grouping columns in front. + * computed later and has the grouping columns in front. */ if (ts_is_decompress_chunk_path(subpath)) { From be5ec30351dbb1090afddd49c56ee781cffaf8fa Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 21 Aug 2024 22:07:46 +0200 Subject: [PATCH 102/157] benchmark partitionwise projection (2024-08-21 no. 3) From 1eae5b57b7229793a2772d57ccd0feb1e5c71db8 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:34:07 +0200 Subject: [PATCH 103/157] reference REL_16_3 transparent_decompression-* --- tsl/test/expected/transparent_decompression-16.out | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index 3331320ae11..cdf5ee15db1 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -9297,18 +9297,16 @@ EXPLAIN (costs off) SELECT time_bucket('10 minutes', time) bucket, avg(v0) avg_v -> Parallel Append -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_1_chunk."time") - -> Result - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_5_15_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Parallel Seq Scan on compress_hyper_5_15_chunk -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_3_chunk."time") - -> Result - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk - -> Parallel Seq Scan on compress_hyper_5_16_chunk + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk + -> Parallel Seq Scan on compress_hyper_5_16_chunk -> Partial HashAggregate Group Key: time_bucket('@ 10 mins'::interval, _hyper_1_2_chunk."time") -> Parallel Seq Scan on _hyper_1_2_chunk -(18 rows) +(16 rows) EXPLAIN (costs off) SELECT * FROM metrics_space ORDER BY time, device_id; QUERY PLAN From 8009a761692f0b37ee929c30e507fb4d15357dbd Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:54:30 +0200 Subject: [PATCH 104/157] fixes after merge --- tsl/src/nodes/vector_agg/plan.c | 4 + .../expected/transparent_decompression-15.out | 202 +++++++------- tsl/test/expected/vectorized_aggregation.out | 252 +++++++++--------- 3 files changed, 222 insertions(+), 236 deletions(-) diff --git a/tsl/src/nodes/vector_agg/plan.c b/tsl/src/nodes/vector_agg/plan.c index ef00ff59246..b9a0af44868 100644 --- a/tsl/src/nodes/vector_agg/plan.c +++ b/tsl/src/nodes/vector_agg/plan.c @@ -429,6 +429,10 @@ try_insert_vector_agg_node(Plan *plan) { append_plans = castNode(Append, plan)->appendplans; } + else if (IsA(plan, MergeAppend)) + { + append_plans = castNode(MergeAppend, plan)->mergeplans; + } else if (IsA(plan, CustomScan)) { CustomScan *custom = castNode(CustomScan, plan); diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index b60e9929458..967db644110 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -1649,14 +1649,39 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(16 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) @@ -1669,36 +1694,7 @@ ORDER BY device_id; -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(18 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(19 rows) +(17 rows) SET enable_hashagg = ON; -- test CTE @@ -5642,14 +5638,58 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(35 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) @@ -5661,22 +5701,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5685,67 +5719,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(45 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(46 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(36 rows) SET enable_hashagg = ON; -- test CTE diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index cc54c3252b7..71e532b33aa 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -108,137 +108,143 @@ SELECT sum(segment_by_value) FROM testtable; -- Vectorization possible - filter on segment_by :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> 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._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> 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._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> 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._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: (_hyper_1_4_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: (_hyper_1_5_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: (_hyper_1_6_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: (_hyper_1_7_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: (_hyper_1_8_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: (_hyper_1_9_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: (_hyper_1_10_chunk.segment_by_value > 0) -(59 rows) + -> Gather + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Workers Planned: 2 + -> Parallel Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: (_hyper_1_4_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: (_hyper_1_5_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: (_hyper_1_6_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: (_hyper_1_7_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: (_hyper_1_8_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: (_hyper_1_9_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: (_hyper_1_10_chunk.segment_by_value > 0) +(62 rows) -- Vectorization not possible due to a used filter :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_value > 0; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - -> 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_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - -> 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_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - -> 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_segment_by_value__ts_meta_sequenc_idx on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) -(62 rows) + -> Gather + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Workers Planned: 2 + -> Parallel Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk._ts_meta_sequence_num, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk._ts_meta_sequence_num, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk._ts_meta_sequence_num, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) +(65 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE int_value > 0; From f1c5782b2502a856e612bab61eb0f469b069028b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:55:45 +0100 Subject: [PATCH 105/157] fix the reference after merge --- tsl/test/expected/vectorized_aggregation.out | 264 ++++++++++--------- 1 file changed, 135 insertions(+), 129 deletions(-) diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 63ff6ed337c..8887dac8469 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -111,143 +111,149 @@ SELECT sum(segment_by_value) FROM testtable; -- Vectorization possible - filter on segment_by :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> Index Scan using compress_hyper_2_11_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> Index Scan using compress_hyper_2_12_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> Index Scan using compress_hyper_2_13_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: (_hyper_1_4_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: (_hyper_1_5_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: (_hyper_1_6_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: (_hyper_1_7_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: (_hyper_1_8_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: (_hyper_1_9_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: (_hyper_1_10_chunk.segment_by_value > 0) -(62 rows) + -> Gather + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Workers Planned: 2 + -> Parallel Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: (_hyper_1_4_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: (_hyper_1_5_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: (_hyper_1_6_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: (_hyper_1_7_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: (_hyper_1_8_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: (_hyper_1_9_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: (_hyper_1_10_chunk.segment_by_value > 0) +(65 rows) -- Vectorization not possible due to a used filter :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_value > 0; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Index Cond: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Index Cond: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Index Cond: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) -(65 rows) + -> Gather + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Workers Planned: 2 + -> Parallel Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) +(68 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE int_value > 0; From 4820a50145b26524e0c7d6dc3f68ca8c7212d3bb Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:23:09 +0100 Subject: [PATCH 106/157] hypercore test --- tsl/test/expected/hypercore_index_btree.out | 299 ++++++++------------ tsl/test/sql/hypercore_index_btree.sql | 1 + 2 files changed, 113 insertions(+), 187 deletions(-) diff --git a/tsl/test/expected/hypercore_index_btree.out b/tsl/test/expected/hypercore_index_btree.out index 805b4d219a0..87c64c873f6 100644 --- a/tsl/test/expected/hypercore_index_btree.out +++ b/tsl/test/expected/hypercore_index_btree.out @@ -111,6 +111,7 @@ select format('%I.%I', chunk_schema, chunk_name)::regclass as chunk2 -- Avoid parallel (index) scans to make test stable set max_parallel_workers_per_gather to 0; set enable_hashagg to off; +set timescaledb.enable_chunkwise_aggregation to off; -- Drop the device_id index and redefine it later with extra columns. drop index hypertable_device_id_idx; create view chunk_indexes as @@ -126,38 +127,25 @@ select explain_anonymize(format($$ select location_id, count(*) into orig from %s where location_id in (3,4,5) group by location_id $$, :'hypertable')); - explain_anonymize ---------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + explain_anonymize +--------------------------------------------------------------------------------------------------- + GroupAggregate Group Key: _hyper_I_N_chunk.location_id - -> Sort + -> Merge Append Sort Key: _hyper_I_N_chunk.location_id - -> Append - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) -(29 rows) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) +(16 rows) select location_id, count(*) into orig from :hypertable where location_id in (3,4,5) group by location_id; @@ -194,38 +182,25 @@ select explain_anonymize(format($$ select owner_id, count(*) into owner_comp from %s where owner_id in (3,4,5) group by owner_id $$, :'hypertable')); - explain_anonymize ---------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + explain_anonymize +--------------------------------------------------------------------------------------------- + GroupAggregate Group Key: _hyper_I_N_chunk.owner_id - -> Sort + -> Merge Append Sort Key: _hyper_I_N_chunk.owner_id - -> Append - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.owner_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk - Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.owner_id - -> Index Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk - Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.owner_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk - Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.owner_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk - Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.owner_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk - Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.owner_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk - Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) -(29 rows) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk + Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) + -> Index Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk + Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk + Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk + Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk + Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_owner_idx on _hyper_I_N_chunk + Index Cond: (owner_id = ANY ('{3,4,5}'::bigint[])) +(16 rows) select owner_id, count(*) into owner_comp from :hypertable where owner_id in (3,4,5) group by owner_id; @@ -266,38 +241,25 @@ select explain_anonymize(format($$ select location_id, count(*) into comp from %s where location_id in (3,4,5) group by location_id $$, :'hypertable')); - explain_anonymize ------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + explain_anonymize +------------------------------------------------------------------------------------------------------------ + GroupAggregate Group Key: _hyper_I_N_chunk.location_id - -> Sort + -> Merge Append Sort Key: _hyper_I_N_chunk.location_id - -> Append - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) - -> Partial GroupAggregate - Group Key: _hyper_I_N_chunk.location_id - -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk - Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) -(29 rows) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_owner_id_idx on _hyper_I_N_chunk + Index Cond: (location_id = ANY ('{3,4,5}'::integer[])) +(16 rows) -- result should be the same select location_id, count(*) into comp from :hypertable where location_id in (3,4,5) group by location_id; @@ -414,44 +376,28 @@ select explain_analyze_anonymize(format($$ select device_id, avg(temp) from %s where device_id between 10 and 20 group by device_id $$, :'hypertable')); - explain_analyze_anonymize --------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) + explain_analyze_anonymize +-------------------------------------------------------------------------------------------------------------------- + GroupAggregate (actual rows=N loops=N) + -> Merge Append (actual rows=N loops=N) Sort Key: _hyper_I_N_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=N loops=N) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) - Sort Key: _hyper_I_N_chunk.device_id - Sort Method: quicksort - -> Custom Scan (ColumnarScan) on _hyper_I_N_chunk (actual rows=N loops=N) - Vectorized Filter: ((device_id >= 10) AND (device_id <= 20)) - Rows Removed by Filter: 133 - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 10) AND (device_id <= 20)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 10) AND (device_id <= 20)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 10) AND (device_id <= 20)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 10) AND (device_id <= 20)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) - Sort Key: _hyper_I_N_chunk.device_id - Sort Method: quicksort - -> Custom Scan (ColumnarScan) on _hyper_I_N_chunk (actual rows=N loops=N) - Vectorized Filter: ((device_id >= 10) AND (device_id <= 20)) - Rows Removed by Filter: 234 + -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 10) AND (device_id <= 20)) + -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 10) AND (device_id <= 20)) + -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 10) AND (device_id <= 20)) + -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 10) AND (device_id <= 20)) + -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 10) AND (device_id <= 20)) + -> Index Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 10) AND (device_id <= 20)) Array Cache Hits: N Array Cache Misses: N Array Cache Evictions: N - Array Decompressions: 578 -(35 rows) + Array Decompressions: 560 +(19 rows) select explain_analyze_anonymize(format($$ select device_id, avg(temp) from %s where device_id between 10 and 20 @@ -656,83 +602,62 @@ select explain_analyze_anonymize(format($$ select location_id, avg(humidity) from %s where location_id between 5 and 10 group by location_id order by location_id $$, :'hypertable')); - explain_analyze_anonymize ----------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) + explain_analyze_anonymize +-------------------------------------------------------------------------------------------------------------------------------------------- + GroupAggregate (actual rows=N loops=N) + -> Merge Append (actual rows=N loops=N) Sort Key: _hyper_I_N_chunk.location_id - Sort Method: quicksort - -> Append (actual rows=N loops=N) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) - Sort Key: _hyper_I_N_chunk.location_id - Sort Method: quicksort - -> Custom Scan (ColumnarScan) on _hyper_I_N_chunk (actual rows=N loops=N) - Scankey: ((location_id >= 5) AND (location_id <= 10)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((location_id >= 5) AND (location_id <= 10)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((location_id >= 5) AND (location_id <= 10)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((location_id >= 5) AND (location_id <= 10)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((location_id >= 5) AND (location_id <= 10)) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) - Sort Key: _hyper_I_N_chunk.location_id - Sort Method: quicksort - -> Custom Scan (ColumnarScan) on _hyper_I_N_chunk (actual rows=N loops=N) - Scankey: ((location_id >= 5) AND (location_id <= 10)) + -> Index Only Scan using _hyper_I_N_chunk_hypertable_location_id_include_humidity_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((location_id >= 5) AND (location_id <= 10)) + Heap Fetches: N + -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((location_id >= 5) AND (location_id <= 10)) + -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((location_id >= 5) AND (location_id <= 10)) + -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((location_id >= 5) AND (location_id <= 10)) + -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((location_id >= 5) AND (location_id <= 10)) + -> Index Scan using _hyper_I_N_chunk_hypertable_location_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((location_id >= 5) AND (location_id <= 10)) Array Cache Hits: N Array Cache Misses: N Array Cache Evictions: N - Array Decompressions: 180 -(33 rows) + Array Decompressions: 150 +(20 rows) select explain_analyze_anonymize(format($$ select device_id, avg(humidity) from %s where device_id between 5 and 10 group by device_id order by device_id $$, :'hypertable')); - explain_analyze_anonymize -------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate (actual rows=N loops=N) - -> Sort (actual rows=N loops=N) + explain_analyze_anonymize +------------------------------------------------------------------------------------------------------------------------- + GroupAggregate (actual rows=N loops=N) + -> Merge Append (actual rows=N loops=N) Sort Key: _hyper_I_N_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=N loops=N) - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 5) AND (device_id <= 10)) - Heap Fetches: N - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 5) AND (device_id <= 10)) - Heap Fetches: N - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 5) AND (device_id <= 10)) - Heap Fetches: N - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 5) AND (device_id <= 10)) - Heap Fetches: N - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 5) AND (device_id <= 10)) - Heap Fetches: N - -> Partial GroupAggregate (actual rows=N loops=N) - -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) - Index Cond: ((device_id >= 5) AND (device_id <= 10)) - Heap Fetches: N + -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 5) AND (device_id <= 10)) + Heap Fetches: N + -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 5) AND (device_id <= 10)) + Heap Fetches: N + -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 5) AND (device_id <= 10)) + Heap Fetches: N + -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 5) AND (device_id <= 10)) + Heap Fetches: N + -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 5) AND (device_id <= 10)) + Heap Fetches: N + -> Index Only Scan using _hyper_I_N_chunk_hypertable_device_id_idx on _hyper_I_N_chunk (actual rows=N loops=N) + Index Cond: ((device_id >= 5) AND (device_id <= 10)) + Heap Fetches: N Array Cache Hits: N Array Cache Misses: N Array Cache Evictions: N Array Decompressions: 0 -(33 rows) +(25 rows) select explain_analyze_anonymize(format($$ select location_id, avg(humidity) from %s where location_id between 5 and 10 diff --git a/tsl/test/sql/hypercore_index_btree.sql b/tsl/test/sql/hypercore_index_btree.sql index bb32489dfa7..72a935cabd5 100644 --- a/tsl/test/sql/hypercore_index_btree.sql +++ b/tsl/test/sql/hypercore_index_btree.sql @@ -11,6 +11,7 @@ set role :ROLE_DEFAULT_PERM_USER; -- Avoid parallel (index) scans to make test stable set max_parallel_workers_per_gather to 0; set enable_hashagg to off; +set timescaledb.enable_chunkwise_aggregation to off; -- Drop the device_id index and redefine it later with extra columns. drop index hypertable_device_id_idx; From 10518fd56bb0dd4df76f71408d9ab31fa6a45ca0 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:24:09 +0100 Subject: [PATCH 107/157] reference REL_17_0-80-gb7467ab71c transparent_decompression-* --- .../expected/transparent_decompression-17.out | 202 ++++++++---------- 1 file changed, 89 insertions(+), 113 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-17.out b/tsl/test/expected/transparent_decompression-17.out index f2878e7d1c3..3e1dd5a0289 100644 --- a/tsl/test/expected/transparent_decompression-17.out +++ b/tsl/test/expected/transparent_decompression-17.out @@ -1646,14 +1646,39 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(16 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) @@ -1666,36 +1691,7 @@ ORDER BY device_id; -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(18 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(19 rows) +(17 rows) SET enable_hashagg = ON; -- test CTE @@ -5641,14 +5637,58 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(35 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) @@ -5660,22 +5700,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5684,67 +5718,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(45 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(46 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(36 rows) SET enable_hashagg = ON; -- test CTE From 2fa334497829cfb6b318a8c3a4acf555f6ccc907 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:24:59 +0100 Subject: [PATCH 108/157] reference REL_14_11 transparent_decompression-* --- .../expected/transparent_decompression-14.out | 202 ++++++++---------- 1 file changed, 89 insertions(+), 113 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index edfa23a6990..32e9c76b2a0 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -1646,14 +1646,39 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(16 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) @@ -1666,36 +1691,7 @@ ORDER BY device_id; -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(18 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(19 rows) +(17 rows) SET enable_hashagg = ON; -- test CTE @@ -5641,14 +5637,58 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(35 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) @@ -5660,22 +5700,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5684,67 +5718,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(45 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(46 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(36 rows) SET enable_hashagg = ON; -- test CTE From 2385f1d448f6094f5ec26e1cebc4c9461308735d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:25:29 +0100 Subject: [PATCH 109/157] reference REL_16_4-111-g925b3aa857 transparent_decompression-* --- .../expected/transparent_decompression-16.out | 202 ++++++++---------- 1 file changed, 89 insertions(+), 113 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index f2878e7d1c3..3e1dd5a0289 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -1646,14 +1646,39 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) + -> Partial GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_2_chunk.device_id + -> Sort (actual rows=3360 loops=1) + Sort Key: _hyper_1_2_chunk.device_id + Sort Method: quicksort + -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) + -> Custom Scan (VectorAgg) (actual rows=5 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) +(16 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 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_1_1_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_1_1_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) @@ -1666,36 +1691,7 @@ ORDER BY device_id; -> Custom Scan (VectorAgg) (actual rows=5 loops=1) -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(18 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_1_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_1_1_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3600 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) - -> Partial GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_1_2_chunk.device_id - -> Sort (actual rows=3360 loops=1) - Sort Key: _hyper_1_2_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_1_2_chunk (actual rows=3360 loops=1) - -> Custom Scan (VectorAgg) (actual rows=5 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=1680 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) -(19 rows) +(17 rows) SET enable_hashagg = ON; -- test CTE @@ -5641,14 +5637,58 @@ SELECT count(*) FROM :TEST_TABLE GROUP BY device_id ORDER BY device_id; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=5 loops=1) Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) + -> Merge Append (actual rows=15 loops=1) Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_7_chunk.device_id + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=3 loops=1) + Group Key: _hyper_2_8_chunk.device_id + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_9_chunk.device_id + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 + -> Custom Scan (VectorAgg) (actual rows=1 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: _hyper_2_12_chunk.device_id + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(35 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 +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + WindowAgg (actual rows=5 loops=1) + -> Finalize GroupAggregate (actual rows=5 loops=1) + Group Key: _hyper_2_4_chunk.device_id + -> Merge Append (actual rows=15 loops=1) + Sort Key: _hyper_2_4_chunk.device_id -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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) @@ -5660,22 +5700,16 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) + -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) + Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) + -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) + Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5684,67 +5718,9 @@ ORDER BY device_id; -> 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) -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(45 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 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - WindowAgg (actual rows=5 loops=1) - -> Finalize GroupAggregate (actual rows=5 loops=1) - Group Key: _hyper_2_4_chunk.device_id - -> Sort (actual rows=15 loops=1) - Sort Key: _hyper_2_4_chunk.device_id - Sort Method: quicksort - -> Append (actual rows=15 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_4_chunk (actual rows=720 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_5_chunk (actual rows=2160 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 (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_6_chunk (actual rows=720 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_7_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_7_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_7_chunk (actual rows=672 loops=1) - -> Partial GroupAggregate (actual rows=3 loops=1) - Group Key: _hyper_2_8_chunk.device_id - -> Sort (actual rows=2016 loops=1) - Sort Key: _hyper_2_8_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_8_chunk (actual rows=2016 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_9_chunk.device_id - -> Sort (actual rows=672 loops=1) - Sort Key: _hyper_2_9_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_9_chunk (actual rows=672 loops=1) - -> Custom Scan (VectorAgg) (actual rows=1 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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 (VectorAgg) (actual rows=3 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_2_11_chunk (actual rows=1008 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) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: _hyper_2_12_chunk.device_id - -> Sort (actual rows=336 loops=1) - Sort Key: _hyper_2_12_chunk.device_id - Sort Method: quicksort - -> Seq Scan on _hyper_2_12_chunk (actual rows=336 loops=1) -(46 rows) + -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) + Heap Fetches: 0 +(36 rows) SET enable_hashagg = ON; -- test CTE From d75dc9e2e3a4f9952cb87b106cfd72363a9d39ca Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:37:32 +0100 Subject: [PATCH 110/157] try to replicate the move of chunkwise to tsl --- src/planner/partialize.c | 711 +----------------------------------- src/planner/partialize.h | 3 - src/planner/planner.c | 20 +- tsl/src/chunkwise_agg.c | 769 +++++++++++++++++++++++++++++++++++++++ tsl/src/chunkwise_agg.h | 16 + 5 files changed, 792 insertions(+), 727 deletions(-) create mode 100644 tsl/src/chunkwise_agg.c create mode 100644 tsl/src/chunkwise_agg.h diff --git a/src/planner/partialize.c b/src/planner/partialize.c index 1e44b7c60c9..8eeaa61d345 100644 --- a/src/planner/partialize.c +++ b/src/planner/partialize.c @@ -4,20 +4,15 @@ * LICENSE-APACHE for a copy of the license. */ #include + #include #include #include #include #include -#include #include -#include #include -#include -#include #include -#include -#include #include #include @@ -25,12 +20,8 @@ #include "debug_assert.h" #include "estimate.h" #include "extension_constants.h" -#include "gapfill.h" -#include "import/planner.h" -#include "nodes/chunk_append/chunk_append.h" #include "nodes/print.h" #include "partialize.h" -#include "planner.h" #include "utils.h" #define TS_PARTIALFN "partialize_agg" @@ -198,706 +189,6 @@ partialize_agg_paths(RelOptInfo *rel) return has_combine; } -/* Helper function to find the first node of the provided type in the pathlist of the relation */ -static Node * -find_node(const RelOptInfo *relation, NodeTag type) -{ - ListCell *lc; - foreach (lc, relation->pathlist) - { - Node *node = lfirst(lc); - if (nodeTag(node) == type) - return node; - } - - return NULL; -} - -/* Check if the relation already has a min/max path */ -static bool -has_min_max_agg_path(const RelOptInfo *relation) -{ - return find_node(relation, T_MinMaxAggPath) != NULL; -} - -/* - * Get an an existing aggregation path for the given relation or NULL if no aggregation path exists. - */ -static AggPath * -get_existing_agg_path(const RelOptInfo *relation) -{ - Node *node = find_node(relation, T_AggPath); - return node ? castNode(AggPath, node) : NULL; -} - -/* - * Get all subpaths from a Append, MergeAppend, or ChunkAppend path - */ -static void -get_subpaths_from_append_path(Path *path, List **subpaths, Path **append, Path **gather) -{ - if (IsA(path, AppendPath)) - { - AppendPath *append_path = castNode(AppendPath, path); - *subpaths = append_path->subpaths; - *append = path; - return; - } - - if (IsA(path, MergeAppendPath)) - { - MergeAppendPath *merge_append_path = castNode(MergeAppendPath, path); - *subpaths = merge_append_path->subpaths; - *append = path; - return; - } - - if (ts_is_chunk_append_path(path)) - { - CustomPath *custom_path = castNode(CustomPath, path); - *subpaths = custom_path->custom_paths; - *append = path; - return; - } - - if (IsA(path, GatherPath)) - { - *gather = path; - get_subpaths_from_append_path(castNode(GatherPath, path)->subpath, - subpaths, - append, - /* gather = */ NULL); - return; - } - - if (IsA(path, GatherMergePath)) - { - *gather = path; - get_subpaths_from_append_path(castNode(GatherMergePath, path)->subpath, - subpaths, - append, - /* gather = */ NULL); - return; - } - - if (IsA(path, SortPath)) - { - /* Can see GatherMerge -> Sort -> Partial HashAggregate in parallel plans. */ - get_subpaths_from_append_path(castNode(SortPath, path)->subpath, subpaths, append, gather); - return; - } - - if (IsA(path, AggPath)) - { - /* Can see GatherMerge -> Sort -> Partial HashAggregate in parallel plans. */ - get_subpaths_from_append_path(castNode(AggPath, path)->subpath, subpaths, append, gather); - return; - } - - if (IsA(path, ProjectionPath)) - { - ProjectionPath *projection = castNode(ProjectionPath, path); - get_subpaths_from_append_path(projection->subpath, subpaths, append, gather); - return; - } - - /* Aggregation push-down is not supported for other path types so far */ -} - -/* - * Copy an AppendPath and set new subpaths. - */ -static AppendPath * -copy_append_path(AppendPath *path, List *subpaths, PathTarget *pathtarget) -{ - AppendPath *newPath = makeNode(AppendPath); - memcpy(newPath, path, sizeof(AppendPath)); - newPath->subpaths = subpaths; - newPath->path.pathtarget = copy_pathtarget(pathtarget); - - cost_append(newPath); - - return newPath; -} - -/* - * Copy a MergeAppendPath and set new subpaths. - */ -static MergeAppendPath * -copy_merge_append_path(PlannerInfo *root, MergeAppendPath *path, List *subpaths, - PathTarget *pathtarget) -{ - MergeAppendPath *newPath = - create_merge_append_path(root, path->path.parent, subpaths, path->path.pathkeys, NULL); - - newPath->path.param_info = path->path.param_info; - newPath->path.pathtarget = copy_pathtarget(pathtarget); - - return newPath; -} - -/* - * Copy an append-like path and set new subpaths - */ -static Path * -copy_append_like_path(PlannerInfo *root, Path *path, List *new_subpaths, PathTarget *pathtarget) -{ - if (IsA(path, AppendPath)) - { - AppendPath *append_path = castNode(AppendPath, path); - AppendPath *new_append_path = copy_append_path(append_path, new_subpaths, pathtarget); - return &new_append_path->path; - } - else if (IsA(path, MergeAppendPath)) - { - MergeAppendPath *merge_append_path = castNode(MergeAppendPath, path); - MergeAppendPath *new_merge_append_path = - copy_merge_append_path(root, merge_append_path, new_subpaths, pathtarget); - return &new_merge_append_path->path; - } - else if (ts_is_chunk_append_path(path)) - { - CustomPath *custom_path = castNode(CustomPath, path); - ChunkAppendPath *chunk_append_path = (ChunkAppendPath *) custom_path; - ChunkAppendPath *new_chunk_append_path = - ts_chunk_append_path_copy(chunk_append_path, new_subpaths, pathtarget); - return &new_chunk_append_path->cpath.path; - } - - /* Should never happen, already checked by caller */ - Ensure(false, "unknown path type"); - pg_unreachable(); -} - -/* - * Generate a partially sorted aggregated agg path on top of a path - */ -static AggPath * -create_sorted_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target, - double d_num_groups, GroupPathExtraData *extra_data) -{ - Query *parse = root->parse; - - /* Determine costs for aggregations */ - AggClauseCosts *agg_partial_costs = &extra_data->agg_partial_costs; - - bool is_sorted = pathkeys_contained_in(root->group_pathkeys, path->pathkeys); - - if (!is_sorted) - { - path = (Path *) create_sort_path(root, path->parent, path, root->group_pathkeys, -1.0); - } - - AggPath *sorted_agg_path = create_agg_path(root, - path->parent, - path, - target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, - AGGSPLIT_INITIAL_SERIAL, -#if PG16_LT - parse->groupClause, -#else - root->processed_groupClause, -#endif - NIL, - agg_partial_costs, - d_num_groups); - - return sorted_agg_path; -} - -/* - * Generate a partially hashed aggregated add path on top of a path - */ -static AggPath * -create_hashed_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target, - double d_num_groups, GroupPathExtraData *extra_data) -{ - /* Determine costs for aggregations */ - AggClauseCosts *agg_partial_costs = &extra_data->agg_partial_costs; - - AggPath *hash_path = create_agg_path(root, - path->parent, - path, - target, - AGG_HASHED, - AGGSPLIT_INITIAL_SERIAL, -#if PG16_LT - root->parse->groupClause, -#else - root->processed_groupClause, -#endif - NIL, - agg_partial_costs, - d_num_groups); - return hash_path; -} - -/* - * Add partially aggregated subpath - */ -static void -add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, - PathTarget *partial_grouping_target, double d_num_groups, - GroupPathExtraData *extra_data, bool can_sort, bool can_hash, - Path *subpath, List **sorted_paths, List **hashed_paths) -{ - /* Translate targetlist for partition */ - AppendRelInfo *appinfo = ts_get_appendrelinfo(root, subpath->parent->relid, false); - PathTarget *chunktarget = copy_pathtarget(partial_grouping_target); - chunktarget->exprs = - castNode(List, adjust_appendrel_attrs(root, (Node *) chunktarget->exprs, 1, &appinfo)); - - /* In declarative partitioning planning, this is done by apply_scanjoin_target_to_path */ - Assert(list_length(subpath->pathtarget->exprs) == list_length(input_target->exprs)); - subpath->pathtarget->sortgrouprefs = input_target->sortgrouprefs; - - if (can_sort) - { - AggPath *agg_path = - create_sorted_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); - - *sorted_paths = lappend(*sorted_paths, (Path *) agg_path); - } - - if (can_hash) - { - AggPath *agg_path = - create_hashed_partial_agg_path(root, subpath, chunktarget, d_num_groups, extra_data); - - *hashed_paths = lappend(*hashed_paths, (Path *) agg_path); - } -} - -/* - * Generate a total aggregation path for partial aggregations. - * - * The generated paths contain partial aggregations (created by using AGGSPLIT_INITIAL_SERIAL). - * These aggregations need to be finished by the caller by adding a node that performs the - * AGGSPLIT_FINAL_DESERIAL step. - * - * The original path can be either parallel or non-parallel aggregation, and the - * resulting path will be parallel accordingly. - */ -static void -generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *input_rel, - RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, - PathTarget *grouping_target, PathTarget *partial_grouping_target, - bool can_sort, bool can_hash, double d_num_groups, - GroupPathExtraData *extra_data) -{ - /* Get subpaths */ - List *subpaths = NIL; - Path *top_gather = NULL; - Path *top_append = NULL; - get_subpaths_from_append_path(cheapest_total_path, &subpaths, &top_append, &top_gather); - - /* No subpaths available or unsupported append node */ - if (subpaths == NIL) - { - return; - } - - Assert(top_append != NULL); - - if (list_length(subpaths) < 2) - { - /* - * Doesn't make sense to add per-chunk aggregation paths if there's - * only one chunk. - */ - return; - } - - /* Generate agg paths on top of the append children */ - List *sorted_subpaths = NIL; - List *hashed_subpaths = NIL; - - ListCell *lc; - foreach (lc, subpaths) - { - Path *subpath = lfirst(lc); - - /* Check if we have an append path under an append path (e.g., a partially compressed - * chunk. The first append path merges the chunk results. The second append path merges the - * uncompressed and the compressed part of the chunk). - * - * In this case, the partial aggregation needs to be pushed down below the lower - * append path. - */ - List *partially_compressed_paths = NIL; - Path *partially_compressed_append = NULL; - Path *partially_compressed_gather = NULL; - get_subpaths_from_append_path(subpath, - &partially_compressed_paths, - &partially_compressed_append, - &partially_compressed_gather); - Assert(partially_compressed_gather == NULL); - - if (partially_compressed_append != NULL) - { - List *partially_compressed_sorted = NIL; - List *partially_compressed_hashed = NIL; - - ListCell *lc2; - foreach (lc2, partially_compressed_paths) - { - Path *partially_compressed_path = lfirst(lc2); - - add_partially_aggregated_subpaths(root, - input_rel->reltarget, - partial_grouping_target, - d_num_groups, - extra_data, - can_sort, - can_hash, - partially_compressed_path, - &partially_compressed_sorted /* Result path */, - &partially_compressed_hashed /* Result path */); - } - - if (can_sort) - { - sorted_subpaths = lappend(sorted_subpaths, - copy_append_like_path(root, - partially_compressed_append, - partially_compressed_sorted, - subpath->pathtarget)); - } - - if (can_hash) - { - hashed_subpaths = lappend(hashed_subpaths, - copy_append_like_path(root, - partially_compressed_append, - partially_compressed_hashed, - subpath->pathtarget)); - } - } - else - { - add_partially_aggregated_subpaths(root, - input_rel->reltarget, - partial_grouping_target, - d_num_groups, - extra_data, - can_sort, - can_hash, - subpath, - &sorted_subpaths /* Result paths */, - &hashed_subpaths /* Result paths */); - } - } - - fprintf(stderr, "have the following sorted subpaths:\n"); - mybt(); - my_print(sorted_subpaths); - - - /* Create new append paths */ - if (top_gather == NULL) - { - /* - * The original aggregation plan was non-parallel, so we're creating a - * non-parallel plan as well. - */ - if (sorted_subpaths != NIL) - { - add_path(partially_grouped_rel, - copy_append_like_path(root, - top_append, - sorted_subpaths, - partial_grouping_target)); - } - - if (hashed_subpaths != NIL) - { - add_path(partially_grouped_rel, - copy_append_like_path(root, - top_append, - hashed_subpaths, - partial_grouping_target)); - } - } - else - { - /* - * The cheapest aggregation plan was parallel, so we're creating a - * parallel plan as well. - */ - if (sorted_subpaths != NIL) - { - add_partial_path(partially_grouped_rel, - copy_append_like_path(root, - top_append, - sorted_subpaths, - partial_grouping_target)); - } - - if (hashed_subpaths != NIL) - { - add_partial_path(partially_grouped_rel, - copy_append_like_path(root, - top_append, - hashed_subpaths, - partial_grouping_target)); - } - - /* Finish the partial paths (just added by add_partial_path to partially_grouped_rel in this - * function) by adding a gather node and add this path to the partially_grouped_rel using - * add_path). */ - foreach (lc, partially_grouped_rel->partial_pathlist) - { - Path *append_path = lfirst(lc); - double total_groups = append_path->rows * append_path->parallel_workers; - - Path *gather_path = (Path *) create_gather_path(root, - partially_grouped_rel, - append_path, - partially_grouped_rel->reltarget, - NULL, - &total_groups); - add_path(partially_grouped_rel, (Path *) gather_path); - } - } -} - -/* - Is the provided path a agg path that uses a sorted or plain agg strategy? -*/ -static bool pg_nodiscard -is_path_sorted_or_plain_agg_path(Path *path) -{ - AggPath *agg_path = castNode(AggPath, path); - Assert(agg_path->aggstrategy == AGG_SORTED || agg_path->aggstrategy == AGG_PLAIN || - agg_path->aggstrategy == AGG_HASHED); - return agg_path->aggstrategy == AGG_SORTED || agg_path->aggstrategy == AGG_PLAIN; -} - -/* - * Check if this path belongs to a plain or sorted aggregation - */ -static bool -contains_path_plain_or_sorted_agg(Path *path) -{ - List *subpaths = NIL; - Path *append = NULL; - Path *gather = NULL; - get_subpaths_from_append_path(path, &subpaths, &append, &gather); - - Ensure(subpaths != NIL, "Unable to determine aggregation type"); - - ListCell *lc; - foreach (lc, subpaths) - { - Path *subpath = lfirst(lc); - - if (IsA(subpath, AggPath)) - return is_path_sorted_or_plain_agg_path(subpath); - } - - /* - * No dedicated aggregation nodes found directly underneath the append node. This could be - * due to two reasons. - * - * (1) Only vectorized aggregation is used and we don't have dedicated Aggregation nods. - * (2) The query plan uses multi-level appends to keep a certain sorting - * - ChunkAppend - * - Merge Append - * - Agg Chunk 1 - * - Agg Chunk 2 - * - Merge Append - * - Agg Chunk 3 - * - Agg Chunk 4 - * - * in both cases, we use a sorted aggregation node to finalize the partial aggregation and - * produce a proper sorting. - */ - return true; -} - -/* - * Replan the aggregation and create a partial aggregation at chunk level and finalize the - * aggregation on top of an append node. - * - * The functionality is inspired by PostgreSQL's create_partitionwise_grouping_paths() function - * - * Generated aggregation paths: - * - * Finalize Aggregate - * -> Append - * -> Partial Aggregation - * - Chunk 1 - * ... - * -> Append of partially compressed chunk 2 - * -> Partial Aggregation - * -> Scan on uncompressed part of chunk 2 - * -> Partial Aggregation - * -> Scan on compressed part of chunk 2 - * ... - * -> Partial Aggregation N - * - Chunk N - */ -void -ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel, - RelOptInfo *output_rel, void *extra) -{ - Query *parse = root->parse; - - /* We are only interested in hypertables */ - if (!ht) - return; - - /* Perform partial aggregation planning only if there is an aggregation is requested */ - if (!parse->hasAggs) - return; - - /* Grouping sets are not supported by the partial aggregation pushdown */ - if (parse->groupingSets) - return; - - /* Don't replan aggregation if we already have a MinMaxAggPath (e.g., created by - * ts_preprocess_first_last_aggregates) */ - if (has_min_max_agg_path(output_rel)) - return; - - /* Is sorting possible ? */ - bool can_sort = grouping_is_sortable(parse->groupClause) && ts_guc_enable_chunkwise_aggregation; - - /* Is hashing possible ? */ - bool can_hash = grouping_is_hashable(parse->groupClause) && - !ts_is_gapfill_path(linitial(output_rel->pathlist)) && enable_hashagg; - - Assert(extra != NULL); - GroupPathExtraData *extra_data = (GroupPathExtraData *) extra; - - /* Determine the number of groups from the already planned aggregation */ - AggPath *existing_agg_path = get_existing_agg_path(output_rel); - if (existing_agg_path == NULL) - { - return; - } - - /* Skip partial aggregations already created by _timescaledb_functions.partialize_agg */ - if (existing_agg_path->aggsplit == AGGSPLIT_INITIAL_SERIAL) - return; - - /* Don't replan aggregation if it contains already partials or non-serializable aggregates */ - if (root->hasNonPartialAggs || root->hasNonSerialAggs) - return; - - double d_num_groups = existing_agg_path->numGroups; - Assert(d_num_groups > 0); - - /* Construct partial group agg upper relation */ - RelOptInfo *partially_grouped_rel = - fetch_upper_rel(root, UPPERREL_PARTIAL_GROUP_AGG, input_rel->relids); - partially_grouped_rel->consider_parallel = input_rel->consider_parallel; - partially_grouped_rel->reloptkind = input_rel->reloptkind; - partially_grouped_rel->serverid = input_rel->serverid; - partially_grouped_rel->userid = input_rel->userid; - partially_grouped_rel->useridiscurrent = input_rel->useridiscurrent; - partially_grouped_rel->fdwroutine = input_rel->fdwroutine; - - /* Build target list for partial aggregate paths */ - PathTarget *grouping_target = output_rel->reltarget; - PathTarget *partial_grouping_target = ts_make_partial_grouping_target(root, grouping_target); - partially_grouped_rel->reltarget = partial_grouping_target; - - /* Calculate aggregation costs */ - if (!extra_data->partial_costs_set) - { - /* Init costs */ - MemSet(&extra_data->agg_partial_costs, 0, sizeof(AggClauseCosts)); - MemSet(&extra_data->agg_final_costs, 0, sizeof(AggClauseCosts)); - - /* partial phase */ - get_agg_clause_costs(root, AGGSPLIT_INITIAL_SERIAL, &extra_data->agg_partial_costs); - - /* final phase */ - get_agg_clause_costs(root, AGGSPLIT_FINAL_DESERIAL, &extra_data->agg_final_costs); - - extra_data->partial_costs_set = true; - } - - /* Generate the aggregation pushdown path */ - generate_agg_pushdown_path(root, - &existing_agg_path->path, - input_rel, - output_rel, - partially_grouped_rel, - grouping_target, - partial_grouping_target, - can_sort, - can_hash, - d_num_groups, - extra_data); - - /* Replan aggregation if we were able to generate partially grouped rel paths */ - if (partially_grouped_rel->pathlist == NIL) - return; - - /* Prefer our paths */ - output_rel->pathlist = NIL; - output_rel->partial_pathlist = NIL; - - /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top - * of them. */ - AggClauseCosts *agg_final_costs = &extra_data->agg_final_costs; - ListCell *lc; - foreach (lc, partially_grouped_rel->pathlist) - { - Path *append_path = lfirst(lc); - - if (contains_path_plain_or_sorted_agg(append_path)) - { - bool is_sorted; - - is_sorted = pathkeys_contained_in(root->group_pathkeys, append_path->pathkeys); - - if (!is_sorted) - { - append_path = (Path *) - create_sort_path(root, output_rel, append_path, root->group_pathkeys, -1.0); - } - - add_path(output_rel, - (Path *) create_agg_path(root, - output_rel, - append_path, - grouping_target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, - AGGSPLIT_FINAL_DESERIAL, -#if PG16_LT - parse->groupClause, -#else - root->processed_groupClause, -#endif - (List *) parse->havingQual, - agg_final_costs, - d_num_groups)); - } - else - { - add_path(output_rel, - (Path *) create_agg_path(root, - output_rel, - append_path, - grouping_target, - AGG_HASHED, - AGGSPLIT_FINAL_DESERIAL, -#if PG16_LT - parse->groupClause, -#else - root->processed_groupClause, -#endif - (List *) parse->havingQual, - agg_final_costs, - d_num_groups)); - } - } -} - /* * Turn an aggregate relation into a partial aggregate relation if aggregates * are enclosed by the partialize_agg function. diff --git a/src/planner/partialize.h b/src/planner/partialize.h index aa5aca9d4d9..8cb4aaed228 100644 --- a/src/planner/partialize.h +++ b/src/planner/partialize.h @@ -10,6 +10,3 @@ #include #include "chunk.h" - -void ts_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel, - RelOptInfo *output_rel, void *extra); diff --git a/src/planner/planner.c b/src/planner/planner.c index dda8a7bd029..d7b1e8223df 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -1472,10 +1472,6 @@ timescaledb_create_upper_paths_hook(PlannerInfo *root, UpperRelationKind stage, if (input_rel != NULL) reltype = ts_classify_relation(root, input_rel, &ht); - if (ts_cm_functions->create_upper_paths_hook != NULL) - ts_cm_functions - ->create_upper_paths_hook(root, stage, input_rel, output_rel, reltype, ht, extra); - if (output_rel != NULL) { /* Modify for INSERTs on a hypertable */ @@ -1492,23 +1488,19 @@ timescaledb_create_upper_paths_hook(PlannerInfo *root, UpperRelationKind stage, } } - if (!ts_guc_enable_optimizations || input_rel == NULL || IS_DUMMY_REL(input_rel)) - return; - - if (!involves_hypertable(root, input_rel)) - return; - - if (stage == UPPERREL_GROUP_AGG && output_rel != NULL) + if (stage == UPPERREL_GROUP_AGG && output_rel != NULL && ts_guc_enable_optimizations && + input_rel != NULL && !IS_DUMMY_REL(input_rel) && involves_hypertable(root, input_rel)) { if (parse->hasAggs) ts_preprocess_first_last_aggregates(root, root->processed_tlist); - if (ts_guc_enable_chunkwise_aggregation) - ts_pushdown_partial_agg(root, ht, input_rel, output_rel, extra); - if (!partials_found) ts_plan_add_hashagg(root, input_rel, output_rel); } + + if (ts_cm_functions->create_upper_paths_hook != NULL) + ts_cm_functions + ->create_upper_paths_hook(root, stage, input_rel, output_rel, reltype, ht, extra); } static bool diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c new file mode 100644 index 00000000000..dc1184876bc --- /dev/null +++ b/tsl/src/chunkwise_agg.c @@ -0,0 +1,769 @@ +/* + * 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. + */ +#include + +#include +#include +#include +#include +#include +#include + +#include "chunkwise_agg.h" + +#include "gapfill.h" +#include "guc.h" +#include "import/planner.h" +#include "nodes/chunk_append/chunk_append.h" +#include "nodes/decompress_chunk/decompress_chunk.h" +#include "planner.h" + +/* Helper function to find the first node of the provided type in the pathlist of the relation */ +static Node * +find_node(const RelOptInfo *relation, NodeTag type) +{ + ListCell *lc; + foreach (lc, relation->pathlist) + { + Node *node = lfirst(lc); + if (nodeTag(node) == type) + return node; + } + + return NULL; +} + +/* Check if the relation already has a min/max path */ +static bool +has_min_max_agg_path(const RelOptInfo *relation) +{ + return find_node(relation, T_MinMaxAggPath) != NULL; +} + +/* + * Get an an existing aggregation path for the given relation or NULL if no aggregation path exists. + */ +static AggPath * +get_existing_agg_path(const RelOptInfo *relation) +{ + Node *node = find_node(relation, T_AggPath); + return node ? castNode(AggPath, node) : NULL; +} + +/* + * Get all subpaths from a Append, MergeAppend, or ChunkAppend path + */ +static void +get_subpaths_from_append_path(Path *path, List **subpaths, Path **append, Path **gather) +{ + if (IsA(path, AppendPath)) + { + AppendPath *append_path = castNode(AppendPath, path); + *subpaths = append_path->subpaths; + *append = path; + return; + } + + if (IsA(path, MergeAppendPath)) + { + MergeAppendPath *merge_append_path = castNode(MergeAppendPath, path); + *subpaths = merge_append_path->subpaths; + *append = path; + return; + } + + if (ts_is_chunk_append_path(path)) + { + CustomPath *custom_path = castNode(CustomPath, path); + *subpaths = custom_path->custom_paths; + *append = path; + return; + } + + if (IsA(path, GatherPath)) + { + *gather = path; + get_subpaths_from_append_path(castNode(GatherPath, path)->subpath, + subpaths, + append, + /* gather = */ NULL); + return; + } + + if (IsA(path, GatherMergePath)) + { + *gather = path; + get_subpaths_from_append_path(castNode(GatherMergePath, path)->subpath, + subpaths, + append, + /* gather = */ NULL); + return; + } + + if (IsA(path, SortPath)) + { + /* Can see GatherMerge -> Sort -> Partial HashAggregate in parallel plans. */ + get_subpaths_from_append_path(castNode(SortPath, path)->subpath, subpaths, append, gather); + return; + } + + if (IsA(path, AggPath)) + { + /* Can see GatherMerge -> Sort -> Partial HashAggregate in parallel plans. */ + get_subpaths_from_append_path(castNode(AggPath, path)->subpath, subpaths, append, gather); + return; + } + + if (IsA(path, ProjectionPath)) + { + ProjectionPath *projection = castNode(ProjectionPath, path); + get_subpaths_from_append_path(projection->subpath, subpaths, append, gather); + return; + } + + /* Aggregation push-down is not supported for other path types so far */ +} + +/* + * Copy an AppendPath and set new subpaths. + */ +static AppendPath * +copy_append_path(AppendPath *path, List *subpaths, PathTarget *pathtarget) +{ + AppendPath *newPath = makeNode(AppendPath); + memcpy(newPath, path, sizeof(AppendPath)); + newPath->subpaths = subpaths; + newPath->path.pathtarget = copy_pathtarget(pathtarget); + + cost_append(newPath); + + return newPath; +} + +/* + * Copy a MergeAppendPath and set new subpaths. + */ +static MergeAppendPath * +copy_merge_append_path(PlannerInfo *root, MergeAppendPath *path, List *subpaths, + PathTarget *pathtarget) +{ + MergeAppendPath *newPath = + create_merge_append_path(root, path->path.parent, subpaths, path->path.pathkeys, NULL); + + newPath->path.param_info = path->path.param_info; + newPath->path.pathtarget = copy_pathtarget(pathtarget); + + return newPath; +} + +/* + * Copy an append-like path and set new subpaths + */ +static Path * +copy_append_like_path(PlannerInfo *root, Path *path, List *new_subpaths, PathTarget *pathtarget) +{ + if (IsA(path, AppendPath)) + { + AppendPath *append_path = castNode(AppendPath, path); + AppendPath *new_append_path = copy_append_path(append_path, new_subpaths, pathtarget); + return &new_append_path->path; + } + else if (IsA(path, MergeAppendPath)) + { + MergeAppendPath *merge_append_path = castNode(MergeAppendPath, path); + MergeAppendPath *new_merge_append_path = + copy_merge_append_path(root, merge_append_path, new_subpaths, pathtarget); + return &new_merge_append_path->path; + } + else if (ts_is_chunk_append_path(path)) + { + CustomPath *custom_path = castNode(CustomPath, path); + ChunkAppendPath *chunk_append_path = (ChunkAppendPath *) custom_path; + ChunkAppendPath *new_chunk_append_path = + ts_chunk_append_path_copy(chunk_append_path, new_subpaths, pathtarget); + return &new_chunk_append_path->cpath.path; + } + else if (IsA(path, ProjectionPath)) + { + /* + * Projection goes under partial aggregation, so here we can just ignore + * it. + */ + return copy_append_like_path(root, + castNode(ProjectionPath, path)->subpath, + new_subpaths, + pathtarget); + } + + /* Should never happen, already checked by caller */ + Ensure(false, "unknown path type"); + pg_unreachable(); +} + +/* + * Generate a partially sorted aggregated agg path on top of a path + */ +static AggPath * +create_sorted_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target, + double d_num_groups, GroupPathExtraData *extra_data) +{ + Query *parse = root->parse; + + /* Determine costs for aggregations */ + AggClauseCosts *agg_partial_costs = &extra_data->agg_partial_costs; + + bool is_sorted = pathkeys_contained_in(root->group_pathkeys, path->pathkeys); + + if (!is_sorted) + { + path = (Path *) create_sort_path(root, path->parent, path, root->group_pathkeys, -1.0); + } + + AggPath *sorted_agg_path = create_agg_path(root, + path->parent, + path, + target, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, + AGGSPLIT_INITIAL_SERIAL, +#if PG16_LT + parse->groupClause, +#else + root->processed_groupClause, +#endif + NIL, + agg_partial_costs, + d_num_groups); + + return sorted_agg_path; +} + +/* + * Generate a partially hashed aggregated add path on top of a path + */ +static AggPath * +create_hashed_partial_agg_path(PlannerInfo *root, Path *path, PathTarget *target, + double d_num_groups, GroupPathExtraData *extra_data) +{ + /* Determine costs for aggregations */ + AggClauseCosts *agg_partial_costs = &extra_data->agg_partial_costs; + + AggPath *hash_path = create_agg_path(root, + path->parent, + path, + target, + AGG_HASHED, + AGGSPLIT_INITIAL_SERIAL, +#if PG16_LT + root->parse->groupClause, +#else + root->processed_groupClause, +#endif + NIL, + agg_partial_costs, + d_num_groups); + return hash_path; +} + +/* + * Add partially aggregated subpath + */ +static void +add_partially_aggregated_subpaths(PlannerInfo *root, PathTarget *input_target, + PathTarget *partial_grouping_target, double d_num_groups, + GroupPathExtraData *extra_data, bool can_sort, bool can_hash, + Path *subpath, List **sorted_paths, List **hashed_paths) +{ + /* Translate targetlist for partition */ + AppendRelInfo *appinfo = ts_get_appendrelinfo(root, subpath->parent->relid, false); + PathTarget *chunk_grouped_target = copy_pathtarget(partial_grouping_target); + chunk_grouped_target->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_grouped_target->exprs, + /* nappinfos = */ 1, + &appinfo)); + + /* + * We might have to project before aggregation. In declarative partitioning + * planning, the projection is applied by apply_scanjoin_target_to_path(). + */ + PathTarget *chunk_target_before_grouping = copy_pathtarget(input_target); + chunk_target_before_grouping->exprs = + castNode(List, + adjust_appendrel_attrs(root, + (Node *) chunk_target_before_grouping->exprs, + /* nappinfos = */ 1, + &appinfo)); + /* + * Note that we cannot use apply_projection_to_path() here, because it might + * modify the targetlist of the projection-capable paths in place, which + * would cause a mismatch when these paths are used in another context. + * + * In case of DecompressChunk path, we can make a copy of it and push the + * projection down to it. + * + * In general, the projection here arises because the pathtarget of the + * table scans is determined early based on the reltarget which lists all + * used columns in attno order, and the pathtarget before grouping is + * computed later and has the grouping columns in front. + */ + if (ts_is_decompress_chunk_path(subpath)) + { + subpath = (Path *) copy_decompress_chunk_path((DecompressChunkPath *) subpath); + subpath->pathtarget = chunk_target_before_grouping; + } + else + { + subpath = (Path *) + create_projection_path(root, subpath->parent, subpath, chunk_target_before_grouping); + } + + if (can_sort) + { + AggPath *agg_path = create_sorted_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); + + *sorted_paths = lappend(*sorted_paths, (Path *) agg_path); + } + + if (can_hash) + { + AggPath *agg_path = create_hashed_partial_agg_path(root, + subpath, + chunk_grouped_target, + d_num_groups, + extra_data); + + *hashed_paths = lappend(*hashed_paths, (Path *) agg_path); + } +} + +/* + * Generate a total aggregation path for partial aggregations. + * + * The generated paths contain partial aggregations (created by using AGGSPLIT_INITIAL_SERIAL). + * These aggregations need to be finished by the caller by adding a node that performs the + * AGGSPLIT_FINAL_DESERIAL step. + * + * The original path can be either parallel or non-parallel aggregation, and the + * resulting path will be parallel accordingly. + */ +static void +generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptInfo *input_rel, + RelOptInfo *output_rel, RelOptInfo *partially_grouped_rel, + PathTarget *grouping_target, PathTarget *partial_grouping_target, + bool can_sort, bool can_hash, double d_num_groups, + GroupPathExtraData *extra_data) +{ + /* Get subpaths */ + List *subpaths = NIL; + Path *top_gather = NULL; + Path *top_append = NULL; + get_subpaths_from_append_path(cheapest_total_path, &subpaths, &top_append, &top_gather); + + /* No subpaths available or unsupported append node */ + if (subpaths == NIL) + { + return; + } + + Assert(top_append != NULL); + + if (list_length(subpaths) < 2) + { + /* + * Doesn't make sense to add per-chunk aggregation paths if there's + * only one chunk. + */ + return; + } + + /* Generate agg paths on top of the append children */ + List *sorted_subpaths = NIL; + List *hashed_subpaths = NIL; + + ListCell *lc; + foreach (lc, subpaths) + { + Path *subpath = lfirst(lc); + + /* Check if we have an append path under an append path (e.g., a partially compressed + * chunk. The first append path merges the chunk results. The second append path merges the + * uncompressed and the compressed part of the chunk). + * + * In this case, the partial aggregation needs to be pushed down below the lower + * append path. + */ + List *partially_compressed_paths = NIL; + Path *partially_compressed_append = NULL; + Path *partially_compressed_gather = NULL; + get_subpaths_from_append_path(subpath, + &partially_compressed_paths, + &partially_compressed_append, + &partially_compressed_gather); + Assert(partially_compressed_gather == NULL); + + if (partially_compressed_append != NULL) + { + List *partially_compressed_sorted = NIL; + List *partially_compressed_hashed = NIL; + + ListCell *lc2; + foreach (lc2, partially_compressed_paths) + { + Path *partially_compressed_path = lfirst(lc2); + + add_partially_aggregated_subpaths(root, + input_rel->reltarget, + partial_grouping_target, + d_num_groups, + extra_data, + can_sort, + can_hash, + partially_compressed_path, + &partially_compressed_sorted /* Result path */, + &partially_compressed_hashed /* Result path */); + } + + if (can_sort) + { + sorted_subpaths = lappend(sorted_subpaths, + copy_append_like_path(root, + partially_compressed_append, + partially_compressed_sorted, + subpath->pathtarget)); + } + + if (can_hash) + { + hashed_subpaths = lappend(hashed_subpaths, + copy_append_like_path(root, + partially_compressed_append, + partially_compressed_hashed, + subpath->pathtarget)); + } + } + else + { + add_partially_aggregated_subpaths(root, + input_rel->reltarget, + partial_grouping_target, + d_num_groups, + extra_data, + can_sort, + can_hash, + subpath, + &sorted_subpaths /* Result paths */, + &hashed_subpaths /* Result paths */); + } + } + + /* Create new append paths */ + if (top_gather == NULL) + { + /* + * The original aggregation plan was non-parallel, so we're creating a + * non-parallel plan as well. + */ + if (sorted_subpaths != NIL) + { + add_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + sorted_subpaths, + partial_grouping_target)); + } + + if (hashed_subpaths != NIL) + { + add_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + hashed_subpaths, + partial_grouping_target)); + } + } + else + { + /* + * The cheapest aggregation plan was parallel, so we're creating a + * parallel plan as well. + */ + if (sorted_subpaths != NIL) + { + add_partial_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + sorted_subpaths, + partial_grouping_target)); + } + + if (hashed_subpaths != NIL) + { + add_partial_path(partially_grouped_rel, + copy_append_like_path(root, + top_append, + hashed_subpaths, + partial_grouping_target)); + } + + /* Finish the partial paths (just added by add_partial_path to partially_grouped_rel in this + * function) by adding a gather node and add this path to the partially_grouped_rel using + * add_path). */ + foreach (lc, partially_grouped_rel->partial_pathlist) + { + Path *append_path = lfirst(lc); + double total_groups = append_path->rows * append_path->parallel_workers; + + Path *gather_path = (Path *) create_gather_path(root, + partially_grouped_rel, + append_path, + partially_grouped_rel->reltarget, + NULL, + &total_groups); + add_path(partially_grouped_rel, (Path *) gather_path); + } + } +} + +/* + Is the provided path a agg path that uses a sorted or plain agg strategy? +*/ +static bool pg_nodiscard +is_path_sorted_or_plain_agg_path(Path *path) +{ + AggPath *agg_path = castNode(AggPath, path); + Assert(agg_path->aggstrategy == AGG_SORTED || agg_path->aggstrategy == AGG_PLAIN || + agg_path->aggstrategy == AGG_HASHED); + return agg_path->aggstrategy == AGG_SORTED || agg_path->aggstrategy == AGG_PLAIN; +} + +/* + * Check if this path belongs to a plain or sorted aggregation + */ +static bool +contains_path_plain_or_sorted_agg(Path *path) +{ + List *subpaths = NIL; + Path *append = NULL; + Path *gather = NULL; + get_subpaths_from_append_path(path, &subpaths, &append, &gather); + + Ensure(subpaths != NIL, "Unable to determine aggregation type"); + + ListCell *lc; + foreach (lc, subpaths) + { + Path *subpath = lfirst(lc); + + if (IsA(subpath, AggPath)) + return is_path_sorted_or_plain_agg_path(subpath); + } + + /* + * No dedicated aggregation nodes found directly underneath the append node. This could be + * due to two reasons. + * + * (1) Only vectorized aggregation is used and we don't have dedicated Aggregation nods. + * (2) The query plan uses multi-level appends to keep a certain sorting + * - ChunkAppend + * - Merge Append + * - Agg Chunk 1 + * - Agg Chunk 2 + * - Merge Append + * - Agg Chunk 3 + * - Agg Chunk 4 + * + * in both cases, we use a sorted aggregation node to finalize the partial aggregation and + * produce a proper sorting. + */ + return true; +} + +/* + * Replan the aggregation and create a partial aggregation at chunk level and finalize the + * aggregation on top of an append node. + * + * The functionality is inspired by PostgreSQL's create_partitionwise_grouping_paths() function + * + * Generated aggregation paths: + * + * Finalize Aggregate + * -> Append + * -> Partial Aggregation + * - Chunk 1 + * ... + * -> Append of partially compressed chunk 2 + * -> Partial Aggregation + * -> Scan on uncompressed part of chunk 2 + * -> Partial Aggregation + * -> Scan on compressed part of chunk 2 + * ... + * -> Partial Aggregation N + * - Chunk N + */ +void +tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel, + RelOptInfo *output_rel, void *extra) +{ + Query *parse = root->parse; + + /* We are only interested in hypertables */ + if (!ht) + return; + + /* Perform partial aggregation planning only if there is an aggregation is requested */ + if (!parse->hasAggs) + return; + + /* Grouping sets are not supported by the partial aggregation pushdown */ + if (parse->groupingSets) + return; + + /* Don't replan aggregation if we already have a MinMaxAggPath (e.g., created by + * ts_preprocess_first_last_aggregates) */ + if (has_min_max_agg_path(output_rel)) + return; + + /* Is sorting possible ? */ + bool can_sort = grouping_is_sortable(parse->groupClause) && ts_guc_enable_chunkwise_aggregation; + + /* Is hashing possible ? */ + bool can_hash = grouping_is_hashable(parse->groupClause) && + !ts_is_gapfill_path(linitial(output_rel->pathlist)) && enable_hashagg; + + Assert(extra != NULL); + GroupPathExtraData *extra_data = (GroupPathExtraData *) extra; + + /* Determine the number of groups from the already planned aggregation */ + AggPath *existing_agg_path = get_existing_agg_path(output_rel); + if (existing_agg_path == NULL) + { + return; + } + + /* Skip partial aggregations already created by _timescaledb_functions.partialize_agg */ + if (existing_agg_path->aggsplit == AGGSPLIT_INITIAL_SERIAL) + return; + + /* Don't replan aggregation if it contains already partials or non-serializable aggregates */ + if (root->hasNonPartialAggs || root->hasNonSerialAggs) + return; + + double d_num_groups = existing_agg_path->numGroups; + Assert(d_num_groups > 0); + + /* Construct partial group agg upper relation */ + RelOptInfo *partially_grouped_rel = + fetch_upper_rel(root, UPPERREL_PARTIAL_GROUP_AGG, input_rel->relids); + partially_grouped_rel->consider_parallel = input_rel->consider_parallel; + partially_grouped_rel->reloptkind = input_rel->reloptkind; + partially_grouped_rel->serverid = input_rel->serverid; + partially_grouped_rel->userid = input_rel->userid; + partially_grouped_rel->useridiscurrent = input_rel->useridiscurrent; + partially_grouped_rel->fdwroutine = input_rel->fdwroutine; + + /* Build target list for partial aggregate paths */ + PathTarget *grouping_target = output_rel->reltarget; + PathTarget *partial_grouping_target = ts_make_partial_grouping_target(root, grouping_target); + partially_grouped_rel->reltarget = partial_grouping_target; + + /* Calculate aggregation costs */ + if (!extra_data->partial_costs_set) + { + /* Init costs */ + MemSet(&extra_data->agg_partial_costs, 0, sizeof(AggClauseCosts)); + MemSet(&extra_data->agg_final_costs, 0, sizeof(AggClauseCosts)); + + /* partial phase */ + get_agg_clause_costs(root, AGGSPLIT_INITIAL_SERIAL, &extra_data->agg_partial_costs); + + /* final phase */ + get_agg_clause_costs(root, AGGSPLIT_FINAL_DESERIAL, &extra_data->agg_final_costs); + + extra_data->partial_costs_set = true; + } + + /* Generate the aggregation pushdown path */ + generate_agg_pushdown_path(root, + &existing_agg_path->path, + input_rel, + output_rel, + partially_grouped_rel, + grouping_target, + partial_grouping_target, + can_sort, + can_hash, + d_num_groups, + extra_data); + + /* Replan aggregation if we were able to generate partially grouped rel paths */ + if (partially_grouped_rel->pathlist == NIL) + return; + + /* Prefer our paths */ + output_rel->pathlist = NIL; + output_rel->partial_pathlist = NIL; + + /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top + * of them. */ + AggClauseCosts *agg_final_costs = &extra_data->agg_final_costs; + ListCell *lc; + foreach (lc, partially_grouped_rel->pathlist) + { + Path *append_path = lfirst(lc); + + if (contains_path_plain_or_sorted_agg(append_path)) + { + bool is_sorted; + + is_sorted = pathkeys_contained_in(root->group_pathkeys, append_path->pathkeys); + + if (!is_sorted) + { + append_path = (Path *) + create_sort_path(root, output_rel, append_path, root->group_pathkeys, -1.0); + } + + add_path(output_rel, + (Path *) create_agg_path(root, + output_rel, + append_path, + grouping_target, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, + AGGSPLIT_FINAL_DESERIAL, +#if PG16_LT + parse->groupClause, +#else + root->processed_groupClause, +#endif + (List *) parse->havingQual, + agg_final_costs, + d_num_groups)); + } + else + { + add_path(output_rel, + (Path *) create_agg_path(root, + output_rel, + append_path, + grouping_target, + AGG_HASHED, + AGGSPLIT_FINAL_DESERIAL, +#if PG16_LT + parse->groupClause, +#else + root->processed_groupClause, +#endif + (List *) parse->havingQual, + agg_final_costs, + d_num_groups)); + } + } +} diff --git a/tsl/src/chunkwise_agg.h b/tsl/src/chunkwise_agg.h new file mode 100644 index 00000000000..15eb42e8cfc --- /dev/null +++ b/tsl/src/chunkwise_agg.h @@ -0,0 +1,16 @@ +/* + * 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. + */ +#pragma once + +#include + +#include + +#include "export.h" +#include "hypertable.h" + +void tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_rel, + RelOptInfo *output_rel, void *extra); From d18bef01adf9ea968bd8a1e91461b1521332507b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:45:38 +0100 Subject: [PATCH 111/157] cleanup --- src/import/planner.c | 4 -- src/nodes/chunk_append/planner.c | 10 ----- src/planner/planner.c | 3 ++ src/planner/planner.h | 3 -- .../nodes/decompress_chunk/decompress_chunk.c | 42 ++++++++++--------- 5 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/import/planner.c b/src/import/planner.c index 82bcfd695fb..ed2960cbbc5 100644 --- a/src/import/planner.c +++ b/src/import/planner.c @@ -387,10 +387,6 @@ ts_make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOpera node->collations = collations; node->nullsFirst = nullsFirst; -// fprintf(stderr, "ts make sort\n"); -// mybt(); -// my_print(node); - return node; } diff --git a/src/nodes/chunk_append/planner.c b/src/nodes/chunk_append/planner.c index 3bd0c0ea51d..30f694557c4 100644 --- a/src/nodes/chunk_append/planner.c +++ b/src/nodes/chunk_append/planner.c @@ -84,12 +84,6 @@ adjust_childscan(PlannerInfo *root, Plan *plan, Path *path, List *pathkeys, List &collations, &nullsFirst); - fprintf(stderr, "required pathkeys:\n"); - my_print(pathkeys); - - fprintf(stderr, "child scan pathkeys:\n"); - my_print(path->pathkeys); - /* inject sort node if child sort order does not match desired order */ if (!pathkeys_contained_in(pathkeys, path->pathkeys)) { @@ -333,10 +327,6 @@ make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOperator node->collations = collations; node->nullsFirst = nullsFirst; - fprintf(stderr, "make sort chunk append\n"); - mybt(); - my_print(node); - return node; } diff --git a/src/planner/planner.c b/src/planner/planner.c index 0b07853b1ba..c70a6c88ec9 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -276,6 +276,9 @@ ts_rte_is_hypertable(const RangeTblEntry *rte) return ht != NULL; } +#define IS_UPDL_CMD(parse) \ + ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) + typedef struct { Query *rootquery; diff --git a/src/planner/planner.h b/src/planner/planner.h index 75b0bcca83a..e82ff36ac46 100644 --- a/src/planner/planner.h +++ b/src/planner/planner.h @@ -24,9 +24,6 @@ */ #define PLANNER_LOCATION_MAGIC -29811 -#define IS_UPDL_CMD(parse) \ - ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) - typedef struct Chunk Chunk; typedef struct Hypertable Hypertable; typedef struct TimescaleDBPrivate diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 8a6f0a0935a..a329d81f102 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -746,8 +746,8 @@ can_batch_sorted_merge(PlannerInfo *root, CompressionInfo *info, const Chunk *ch * To save planning time, we therefore refrain from adding them. */ static Path * -make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertable *ht, Index ht_relid, - Path *path, Path *compressed_path) +make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertable *ht, + Index ht_relid, Path *path, Path *compressed_path) { if (root->query_pathkeys == NIL) { @@ -895,9 +895,11 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con chunk_rel->rows = new_row_estimate; create_compressed_scan_paths(root, compressed_rel, compression_info, &sort_info); - fprintf(stderr, "sortinfo: seqnum %d, pushdown %d, reverse %d, compressed pks:\n", - sort_info.needs_sequence_num, sort_info.can_pushdown_sort, - sort_info.reverse); + fprintf(stderr, + "sortinfo: seqnum %d, pushdown %d, reverse %d, compressed pks:\n", + sort_info.needs_sequence_num, + sort_info.can_pushdown_sort, + sort_info.reverse); my_print(sort_info.required_compressed_pathkeys); /* compute parent relids of the chunk and use it to filter paths*/ @@ -1154,21 +1156,23 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con */ if (path->pathkeys == NIL) { - path = (Path *) create_append_path(root, - chunk_rel, - list_make2(path, uncompressed_path), - NIL /* partial paths */, - NIL, // path->pathkeys, - req_outer, - 0, - false, - path->rows + uncompressed_path->rows); + path = (Path *) create_append_path(root, + chunk_rel, + list_make2(path, uncompressed_path), + NIL /* partial paths */, + NIL, // path->pathkeys, + req_outer, + 0, + false, + path->rows + uncompressed_path->rows); } else { - path = (Path *) create_merge_append_path(root, chunk_rel, - list_make2(path, uncompressed_path), path->pathkeys, - req_outer); + path = (Path *) create_merge_append_path(root, + chunk_rel, + list_make2(path, uncompressed_path), + path->pathkeys, + req_outer); } add_path(chunk_rel, path); } @@ -1262,8 +1266,8 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con add_partial_path(chunk_rel, path); } - /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be - * freed if it's planned */ + /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't + * be freed if it's planned */ compressed_rel->partial_pathlist = NIL; } /* Remove the compressed_rel from the simple_rel_array to prevent it from From eb0cfe4ba0d1fbbb774f3b6ba97d2379bb09524d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:30:30 +0100 Subject: [PATCH 112/157] partialize the entire pathlist --- tsl/src/chunkwise_agg.c | 47 +++++-- tsl/test/expected/agg_partials_pushdown.out | 134 ++++++++++---------- tsl/test/expected/cagg_union_view-15.out | 110 ++++++++-------- 3 files changed, 149 insertions(+), 142 deletions(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index dc1184876bc..5d319e5f4b2 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -632,7 +632,7 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re return; /* Is sorting possible ? */ - bool can_sort = grouping_is_sortable(parse->groupClause) && ts_guc_enable_chunkwise_aggregation; + bool can_sort = grouping_is_sortable(parse->groupClause); /* Is hashing possible ? */ bool can_hash = grouping_is_hashable(parse->groupClause) && @@ -663,6 +663,7 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re RelOptInfo *partially_grouped_rel = fetch_upper_rel(root, UPPERREL_PARTIAL_GROUP_AGG, input_rel->relids); partially_grouped_rel->consider_parallel = input_rel->consider_parallel; + partially_grouped_rel->consider_startup = input_rel->consider_startup; partially_grouped_rel->reloptkind = input_rel->reloptkind; partially_grouped_rel->serverid = input_rel->serverid; partially_grouped_rel->userid = input_rel->userid; @@ -690,18 +691,37 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re extra_data->partial_costs_set = true; } - /* Generate the aggregation pushdown path */ - generate_agg_pushdown_path(root, - &existing_agg_path->path, - input_rel, - output_rel, - partially_grouped_rel, - grouping_target, - partial_grouping_target, - can_sort, - can_hash, - d_num_groups, - extra_data); + /* + * For queries with LIMIT, the aggregated relation can have a path with low + * total cost, and a path with low startup cost. We must partialize both, so + * loop through the entire pathlist. + */ + ListCell *lc; + foreach (lc, output_rel->pathlist) + { + Node *path = lfirst(lc); + if (!IsA(path, AggPath)) + { + /* + * Shouldn't happen, but here we work with arbitrary paths we don't + * control, so it's not an assertion. + */ + continue; + } + + /* Generate the aggregation pushdown path */ + generate_agg_pushdown_path(root, + (Path *) path, + input_rel, + output_rel, + partially_grouped_rel, + grouping_target, + partial_grouping_target, + can_sort, + can_hash, + d_num_groups, + extra_data); + } /* Replan aggregation if we were able to generate partially grouped rel paths */ if (partially_grouped_rel->pathlist == NIL) @@ -714,7 +734,6 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top * of them. */ AggClauseCosts *agg_final_costs = &extra_data->agg_final_costs; - ListCell *lc; foreach (lc, partially_grouped_rel->pathlist) { Path *append_path = lfirst(lc); diff --git a/tsl/test/expected/agg_partials_pushdown.out b/tsl/test/expected/agg_partials_pushdown.out index a54d489bed8..4839d002561 100644 --- a/tsl/test/expected/agg_partials_pushdown.out +++ b/tsl/test/expected/agg_partials_pushdown.out @@ -322,44 +322,41 @@ SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t :PREFIX SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) - -> Sort (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) - Sort Key: _hyper_3_7_chunk.timecustom DESC NULLS LAST - Sort Method: top-N heapsort - -> Finalize HashAggregate (actual rows=6 loops=1) - Output: _hyper_3_7_chunk.timecustom, min(_hyper_3_7_chunk.series_0) - Group Key: _hyper_3_7_chunk.timecustom - Batches: 1 - -> Append (actual rows=7 loops=1) - -> Partial HashAggregate (actual rows=1 loops=1) - Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) - Group Key: _hyper_3_7_chunk.timecustom - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 - -> Partial HashAggregate (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) - Group Key: _hyper_3_6_chunk.timecustom - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 - -> Partial HashAggregate (actual rows=1 loops=1) + Output: testtable2.timecustom, (min(testtable2.series_0)) + -> Finalize GroupAggregate (actual rows=2 loops=1) + Output: testtable2.timecustom, min(testtable2.series_0) + Group Key: testtable2.timecustom + -> Custom Scan (ChunkAppend) on public.testtable2 (actual rows=3 loops=1) + Output: testtable2.timecustom, (PARTIAL min(testtable2.series_0)) + Order: testtable2.timecustom DESC NULLS LAST + Startup Exclusion: false + Runtime Exclusion: false + -> Partial GroupAggregate (actual rows=1 loops=1) + Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) + Group Key: _hyper_3_7_chunk.timecustom + -> Index Scan using _hyper_3_7_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) + Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 + -> Partial GroupAggregate (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) + Group Key: _hyper_3_6_chunk.timecustom + -> Index Scan using _hyper_3_6_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 + -> Merge Append (actual rows=1 loops=1) + Sort Key: _hyper_3_8_chunk.timecustom DESC NULLS LAST + -> Partial GroupAggregate (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, PARTIAL min(_hyper_3_8_chunk.series_0) Group Key: _hyper_3_8_chunk.timecustom - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) + -> Index Scan using _hyper_3_8_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, _hyper_3_8_chunk.series_0 - -> Partial HashAggregate (actual rows=4 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) Output: _hyper_3_5_chunk.timecustom, PARTIAL min(_hyper_3_5_chunk.series_0) Group Key: _hyper_3_5_chunk.timecustom - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_5_chunk (actual rows=7 loops=1) + -> Index Scan using _hyper_3_5_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_5_chunk (actual rows=4 loops=1) Output: _hyper_3_5_chunk.timecustom, _hyper_3_5_chunk.series_0 -(35 rows) +(32 rows) -- Force parallel query SELECT set_config(CASE WHEN current_setting('server_version_num')::int < 160000 THEN 'force_parallel_mode' ELSE 'debug_parallel_query' END,'on', false); @@ -379,61 +376,58 @@ SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t :PREFIX SELECT timeCustom t, min(series_0) FROM PUBLIC.testtable2 GROUP BY t ORDER BY t DESC NULLS LAST limit 2; - QUERY PLAN ----------------------------------------------------------------------------------------------------------------- + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Gather (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) + Output: testtable2.timecustom, (min(testtable2.series_0)) Workers Planned: 1 Workers Launched: 1 Single Copy: true -> Limit (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) + Output: testtable2.timecustom, (min(testtable2.series_0)) Worker 0: actual rows=2 loops=1 - -> Sort (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, (min(_hyper_3_7_chunk.series_0)) - Sort Key: _hyper_3_7_chunk.timecustom DESC NULLS LAST + -> Finalize GroupAggregate (actual rows=2 loops=1) + Output: testtable2.timecustom, min(testtable2.series_0) + Group Key: testtable2.timecustom Worker 0: actual rows=2 loops=1 - Sort Method: top-N heapsort - -> Finalize HashAggregate (actual rows=6 loops=1) - Output: _hyper_3_7_chunk.timecustom, min(_hyper_3_7_chunk.series_0) - Group Key: _hyper_3_7_chunk.timecustom - Worker 0: actual rows=6 loops=1 - Batches: 1 - -> Append (actual rows=7 loops=1) - Worker 0: actual rows=7 loops=1 - -> Partial HashAggregate (actual rows=1 loops=1) - Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) - Group Key: _hyper_3_7_chunk.timecustom - Worker 0: actual rows=1 loops=1 - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) - Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 - Worker 0: actual rows=2 loops=1 - -> Partial HashAggregate (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) - Group Key: _hyper_3_6_chunk.timecustom + -> Custom Scan (ChunkAppend) on public.testtable2 (actual rows=3 loops=1) + Output: testtable2.timecustom, (PARTIAL min(testtable2.series_0)) + Order: testtable2.timecustom DESC NULLS LAST + Startup Exclusion: false + Runtime Exclusion: false + Worker 0: actual rows=3 loops=1 + -> Partial GroupAggregate (actual rows=1 loops=1) + Output: _hyper_3_7_chunk.timecustom, PARTIAL min(_hyper_3_7_chunk.series_0) + Group Key: _hyper_3_7_chunk.timecustom + Worker 0: actual rows=1 loops=1 + -> Index Scan using _hyper_3_7_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_7_chunk (actual rows=2 loops=1) + Output: _hyper_3_7_chunk.timecustom, _hyper_3_7_chunk.series_0 + Worker 0: actual rows=2 loops=1 + -> Partial GroupAggregate (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, PARTIAL min(_hyper_3_6_chunk.series_0) + Group Key: _hyper_3_6_chunk.timecustom + Worker 0: actual rows=1 loops=1 + -> Index Scan using _hyper_3_6_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) + Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 Worker 0: actual rows=1 loops=1 - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_6_chunk (actual rows=1 loops=1) - Output: _hyper_3_6_chunk.timecustom, _hyper_3_6_chunk.series_0 - Worker 0: actual rows=1 loops=1 - -> Partial HashAggregate (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: _hyper_3_8_chunk.timecustom DESC NULLS LAST + Worker 0: actual rows=1 loops=1 + -> Partial GroupAggregate (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, PARTIAL min(_hyper_3_8_chunk.series_0) Group Key: _hyper_3_8_chunk.timecustom Worker 0: actual rows=1 loops=1 - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) + -> Index Scan using _hyper_3_8_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_8_chunk (actual rows=1 loops=1) Output: _hyper_3_8_chunk.timecustom, _hyper_3_8_chunk.series_0 Worker 0: actual rows=1 loops=1 - -> Partial HashAggregate (actual rows=4 loops=1) + -> Partial GroupAggregate (actual rows=1 loops=1) Output: _hyper_3_5_chunk.timecustom, PARTIAL min(_hyper_3_5_chunk.series_0) Group Key: _hyper_3_5_chunk.timecustom - Worker 0: actual rows=4 loops=1 - Batches: 1 - -> Seq Scan on _timescaledb_internal._hyper_3_5_chunk (actual rows=7 loops=1) + Worker 0: actual rows=1 loops=1 + -> Index Scan using _hyper_3_5_chunk_testtable2_timecustom_device_id_idx on _timescaledb_internal._hyper_3_5_chunk (actual rows=4 loops=1) Output: _hyper_3_5_chunk.timecustom, _hyper_3_5_chunk.series_0 - Worker 0: actual rows=7 loops=1 -(52 rows) + Worker 0: actual rows=4 loops=1 +(49 rows) -- Test that we don't process groupingSets :PREFIX diff --git a/tsl/test/expected/cagg_union_view-15.out b/tsl/test/expected/cagg_union_view-15.out index d352ee34b7b..d53b0825a20 100644 --- a/tsl/test/expected/cagg_union_view-15.out +++ b/tsl/test/expected/cagg_union_view-15.out @@ -355,31 +355,29 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=4 loops=1) Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) - -> Sort (actual rows=4 loops=1) + -> Merge Append (actual rows=4 loops=1) Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=4 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_6_chunk."time") - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(22 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(20 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -403,26 +401,24 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) -> Finalize GroupAggregate (actual rows=2 loops=1) Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) - -> Sort (actual rows=2 loops=1) + -> Merge Append (actual rows=2 loops=1) Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=2 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(17 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(15 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -592,8 +588,8 @@ ORDER by 1; -- plan output :PREFIX SELECT * FROM mat_m1 ORDER BY 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=3 loops=1) Sort Key: _hyper_9_15_chunk.time_bucket Sort Method: quicksort @@ -604,27 +600,25 @@ ORDER by 1; Group Key: (time_bucket(5, _hyper_7_11_chunk.a)) Filter: ((sum(_hyper_7_11_chunk.c) > 50) AND ((avg(_hyper_7_11_chunk.b))::integer > 12)) Rows Removed by Filter: 1 - -> Sort (actual rows=3 loops=1) + -> Merge Append (actual rows=3 loops=1) Sort Key: (time_bucket(5, _hyper_7_11_chunk.a)) - Sort Method: quicksort - -> Append (actual rows=3 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(5, _hyper_7_11_chunk.a) - -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(5, _hyper_7_13_chunk.a) - -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(5, _hyper_7_14_chunk.a) - -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - Rows Removed by Filter: 2 -(30 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_13_chunk.a) + -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_14_chunk.a) + -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + Rows Removed by Filter: 2 +(28 rows) -- Test caggs with different time types CREATE TABLE smallint_table (time smallint, value int); From 518132b3c0b01329b5bfa67855c23c005fc4e153 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:40:42 +0100 Subject: [PATCH 113/157] fix another hypercore test --- tsl/test/expected/hypercore_scans.out | 52 +++++++++++---------------- tsl/test/sql/hypercore_scans.sql | 3 ++ 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/tsl/test/expected/hypercore_scans.out b/tsl/test/expected/hypercore_scans.out index 7c4a9792c23..dd4f37f39d0 100644 --- a/tsl/test/expected/hypercore_scans.out +++ b/tsl/test/expected/hypercore_scans.out @@ -1,6 +1,8 @@ -- 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. +-- Avoid chunkwise aggregation to make the test stable +set timescaledb.enable_chunkwise_aggregation to off; create table readings(time timestamptz, location text, device int, @@ -222,43 +224,29 @@ select device, humidity from readings where device between 5 and 10; explain (analyze, costs off, timing off, summary off, decompress_cache_stats) select device, avg(humidity) from readings where device between 5 and 10 group by device; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ - Finalize GroupAggregate (actual rows=6 loops=1) + QUERY PLAN +----------------------------------------------------------------------------------------------------------------- + HashAggregate (actual rows=6 loops=1) Group Key: _hyper_1_1_chunk.device - -> Sort (actual rows=36 loops=1) - Sort Key: _hyper_1_1_chunk.device - Sort Method: quicksort - -> Append (actual rows=36 loops=1) - -> Partial GroupAggregate (actual rows=6 loops=1) - Group Key: _hyper_1_1_chunk.device - -> Index Scan using _hyper_1_1_chunk_readings_device_idx on _hyper_1_1_chunk (actual rows=35 loops=1) - Index Cond: ((device >= 5) AND (device <= 10)) - -> Partial GroupAggregate (actual rows=6 loops=1) - Group Key: _hyper_1_2_chunk.device - -> Index Scan using _hyper_1_2_chunk_readings_device_idx on _hyper_1_2_chunk (actual rows=421 loops=1) - Index Cond: ((device >= 5) AND (device <= 10)) - -> Partial GroupAggregate (actual rows=6 loops=1) - Group Key: _hyper_1_3_chunk.device - -> Index Scan using _hyper_1_3_chunk_readings_device_idx on _hyper_1_3_chunk (actual rows=403 loops=1) - Index Cond: ((device >= 5) AND (device <= 10)) - -> Partial GroupAggregate (actual rows=6 loops=1) - Group Key: _hyper_1_4_chunk.device - -> Index Scan using _hyper_1_4_chunk_readings_device_idx on _hyper_1_4_chunk (actual rows=377 loops=1) - Index Cond: ((device >= 5) AND (device <= 10)) - -> Partial GroupAggregate (actual rows=6 loops=1) - Group Key: _hyper_1_5_chunk.device - -> Index Scan using _hyper_1_5_chunk_readings_device_idx on _hyper_1_5_chunk (actual rows=395 loops=1) - Index Cond: ((device >= 5) AND (device <= 10)) - -> Partial GroupAggregate (actual rows=6 loops=1) - Group Key: _hyper_1_6_chunk.device - -> Index Scan using _hyper_1_6_chunk_readings_device_idx on _hyper_1_6_chunk (actual rows=74 loops=1) - Index Cond: ((device >= 5) AND (device <= 10)) + Batches: 1 + -> Append (actual rows=1705 loops=1) + -> Index Scan using _hyper_1_1_chunk_readings_device_idx on _hyper_1_1_chunk (actual rows=35 loops=1) + Index Cond: ((device >= 5) AND (device <= 10)) + -> Index Scan using _hyper_1_2_chunk_readings_device_idx on _hyper_1_2_chunk (actual rows=421 loops=1) + Index Cond: ((device >= 5) AND (device <= 10)) + -> Index Scan using _hyper_1_3_chunk_readings_device_idx on _hyper_1_3_chunk (actual rows=403 loops=1) + Index Cond: ((device >= 5) AND (device <= 10)) + -> Index Scan using _hyper_1_4_chunk_readings_device_idx on _hyper_1_4_chunk (actual rows=377 loops=1) + Index Cond: ((device >= 5) AND (device <= 10)) + -> Index Scan using _hyper_1_5_chunk_readings_device_idx on _hyper_1_5_chunk (actual rows=395 loops=1) + Index Cond: ((device >= 5) AND (device <= 10)) + -> Index Scan using _hyper_1_6_chunk_readings_device_idx on _hyper_1_6_chunk (actual rows=74 loops=1) + Index Cond: ((device >= 5) AND (device <= 10)) Array Cache Hits: 0 Array Cache Misses: 6 Array Cache Evictions: 0 Array Decompressions: 6 -(34 rows) +(20 rows) -- Test on conflict: insert the same data as before, but throw away -- the updates. diff --git a/tsl/test/sql/hypercore_scans.sql b/tsl/test/sql/hypercore_scans.sql index da3b345edfd..63beaef30f3 100644 --- a/tsl/test/sql/hypercore_scans.sql +++ b/tsl/test/sql/hypercore_scans.sql @@ -2,6 +2,9 @@ -- Please see the included NOTICE for copyright information and -- LICENSE-TIMESCALE for a copy of the license. +-- Avoid chunkwise aggregation to make the test stable +set timescaledb.enable_chunkwise_aggregation to off; + create table readings(time timestamptz, location text, device int, From 7af9df6b229ba14b4a7d43da3b21baef0c4c9c6f Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:41:34 +0100 Subject: [PATCH 114/157] reference REL_17_0-80-gb7467ab71c cagg_union_view-* --- tsl/test/expected/cagg_union_view-17.out | 68 +++++++++++------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/tsl/test/expected/cagg_union_view-17.out b/tsl/test/expected/cagg_union_view-17.out index 436a465c123..82256a15725 100644 --- a/tsl/test/expected/cagg_union_view-17.out +++ b/tsl/test/expected/cagg_union_view-17.out @@ -355,31 +355,29 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=4 loops=1) Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) - -> Sort (actual rows=4 loops=1) + -> Merge Append (actual rows=4 loops=1) Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=4 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_6_chunk."time") - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(22 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(20 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -403,26 +401,24 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) -> Finalize GroupAggregate (actual rows=2 loops=1) Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) - -> Sort (actual rows=2 loops=1) + -> Merge Append (actual rows=2 loops=1) Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=2 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(17 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(15 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; From d786a6526504fec905080212874d16cb32fc3637 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:47:24 +0100 Subject: [PATCH 115/157] fix the debug guc --- tsl/src/nodes/vector_agg/plan.c | 4 + tsl/test/expected/compression_ddl.out | 165 +++++++++++------------ tsl/test/expected/continuous_aggs-15.out | 50 ++++--- tsl/test/expected/vector_agg_memory.out | 37 +++-- 4 files changed, 126 insertions(+), 130 deletions(-) diff --git a/tsl/src/nodes/vector_agg/plan.c b/tsl/src/nodes/vector_agg/plan.c index f7a58ec5326..210b3f322a2 100644 --- a/tsl/src/nodes/vector_agg/plan.c +++ b/tsl/src/nodes/vector_agg/plan.c @@ -409,6 +409,10 @@ has_vector_agg_node(Plan *plan, bool *has_normal_agg) { append_plans = castNode(Append, plan)->appendplans; } + if (IsA(plan, MergeAppend)) + { + append_plans = castNode(MergeAppend, plan)->mergeplans; + } else if (IsA(plan, CustomScan)) { custom = castNode(CustomScan, plan); diff --git a/tsl/test/expected/compression_ddl.out b/tsl/test/expected/compression_ddl.out index ecbbdc8828b..edb7008c317 100644 --- a/tsl/test/expected/compression_ddl.out +++ b/tsl/test/expected/compression_ddl.out @@ -1444,20 +1444,19 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_110_chunk.device_id - -> Sort + -> Merge Append Sort Key: _hyper_31_110_chunk.device_id - -> Append - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_110_chunk.device_id - -> Index Only Scan using _hyper_31_110_chunk_compression_insert_device_id_time_idx on _hyper_31_110_chunk -(11 rows) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Partial GroupAggregate + Group Key: _hyper_31_110_chunk.device_id + -> Index Only Scan using _hyper_31_110_chunk_compression_insert_device_id_time_idx on _hyper_31_110_chunk +(10 rows) SELECT device_id, count(*) FROM compression_insert @@ -1528,23 +1527,22 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_110_chunk.device_id - -> Sort + -> Merge Append Sort Key: _hyper_31_110_chunk.device_id - -> Append - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_112_chunk.device_id - -> Index Only Scan using _hyper_31_112_chunk_compression_insert_device_id_time_idx on _hyper_31_112_chunk -(14 rows) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Partial GroupAggregate + Group Key: _hyper_31_112_chunk.device_id + -> Index Only Scan using _hyper_31_112_chunk_compression_insert_device_id_time_idx on _hyper_31_112_chunk +(13 rows) SELECT device_id, count(*) FROM compression_insert @@ -1615,26 +1613,25 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_110_chunk.device_id - -> Sort + -> Merge Append Sort Key: _hyper_31_110_chunk.device_id - -> Append - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_114_chunk.device_id - -> Index Only Scan using _hyper_31_114_chunk_compression_insert_device_id_time_idx on _hyper_31_114_chunk -(17 rows) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk + -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Partial GroupAggregate + Group Key: _hyper_31_114_chunk.device_id + -> Index Only Scan using _hyper_31_114_chunk_compression_insert_device_id_time_idx on _hyper_31_114_chunk +(16 rows) SELECT device_id, count(*) FROM compression_insert @@ -1705,29 +1702,28 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_110_chunk.device_id - -> Sort + -> Merge Append Sort Key: _hyper_31_110_chunk.device_id - -> Append - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk - -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_116_chunk.device_id - -> Index Only Scan using _hyper_31_116_chunk_compression_insert_device_id_time_idx on _hyper_31_116_chunk -(20 rows) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk + -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk + -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk + -> Partial GroupAggregate + Group Key: _hyper_31_116_chunk.device_id + -> Index Only Scan using _hyper_31_116_chunk_compression_insert_device_id_time_idx on _hyper_31_116_chunk +(19 rows) SELECT device_id, count(*) FROM compression_insert @@ -1798,32 +1794,31 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_110_chunk.device_id - -> Sort + -> Merge Append Sort Key: _hyper_31_110_chunk.device_id - -> Append - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk - -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_118_chunk - -> Index Scan using compress_hyper_32_119_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_119_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_118_chunk.device_id - -> Index Only Scan using _hyper_31_118_chunk_compression_insert_device_id_time_idx on _hyper_31_118_chunk -(23 rows) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk + -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk + -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_118_chunk + -> Index Scan using compress_hyper_32_119_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_119_chunk + -> Partial GroupAggregate + Group Key: _hyper_31_118_chunk.device_id + -> Index Only Scan using _hyper_31_118_chunk_compression_insert_device_id_time_idx on _hyper_31_118_chunk +(22 rows) SELECT device_id, count(*) FROM compression_insert diff --git a/tsl/test/expected/continuous_aggs-15.out b/tsl/test/expected/continuous_aggs-15.out index 478825ae14f..8e2289908d9 100644 --- a/tsl/test/expected/continuous_aggs-15.out +++ b/tsl/test/expected/continuous_aggs-15.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2049,18 +2049,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(23 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(22 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2073,8 +2072,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2089,18 +2088,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(25 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(24 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); diff --git a/tsl/test/expected/vector_agg_memory.out b/tsl/test/expected/vector_agg_memory.out index 868075cc890..1600fbba164 100644 --- a/tsl/test/expected/vector_agg_memory.out +++ b/tsl/test/expected/vector_agg_memory.out @@ -79,28 +79,27 @@ set work_mem = '64kB'; explain (costs off) select ts_debug_allocated_bytes() bytes, count(*) a, count(t) b, sum(t) c, avg(t) d, min(t) e, max(t) f from mvagg where t >= -1 and t < 1000000 group by s1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_1_1_chunk.s1 - -> Sort + -> Merge Append Sort Key: _hyper_1_1_chunk.s1 - -> Append - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - Vectorized Filter: ((t >= '-1'::integer) AND (t < 1000000)) - -> Sort - Sort Key: compress_hyper_2_3_chunk.s1 - -> Seq Scan on compress_hyper_2_3_chunk - Filter: ((_ts_meta_max_1 >= '-1'::integer) AND (_ts_meta_min_1 < 1000000)) - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk - Vectorized Filter: ((t >= '-1'::integer) AND (t < 1000000)) - -> Sort - Sort Key: compress_hyper_2_4_chunk.s1 - -> Index Scan using compress_hyper_2_4_chunk_s0_s1__ts_meta_min_1__ts_meta_max__idx on compress_hyper_2_4_chunk - Index Cond: ((_ts_meta_min_1 < 1000000) AND (_ts_meta_max_1 >= '-1'::integer)) -(19 rows) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + Vectorized Filter: ((t >= '-1'::integer) AND (t < 1000000)) + -> Sort + Sort Key: compress_hyper_2_3_chunk.s1 + -> Seq Scan on compress_hyper_2_3_chunk + Filter: ((_ts_meta_max_1 >= '-1'::integer) AND (_ts_meta_min_1 < 1000000)) + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk + Vectorized Filter: ((t >= '-1'::integer) AND (t < 1000000)) + -> Sort + Sort Key: compress_hyper_2_4_chunk.s1 + -> Index Scan using compress_hyper_2_4_chunk_s0_s1__ts_meta_min_1__ts_meta_max__idx on compress_hyper_2_4_chunk + Index Cond: ((_ts_meta_min_1 < 1000000) AND (_ts_meta_max_1 >= '-1'::integer)) +(18 rows) \set ECHO none reset timescaledb.debug_require_vector_agg; From 12e5dd4a23efbaf7ee0214bd24bef312e6f1a412 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:49:01 +0100 Subject: [PATCH 116/157] reference REL_17_0-80-gb7467ab71c cagg_union_view-* continuous_aggs-* transparent_decompression-* --- tsl/test/expected/continuous_aggs-17.out | 50 ++++++++++++------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/tsl/test/expected/continuous_aggs-17.out b/tsl/test/expected/continuous_aggs-17.out index 7a52c68c544..38804430ea2 100644 --- a/tsl/test/expected/continuous_aggs-17.out +++ b/tsl/test/expected/continuous_aggs-17.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2049,18 +2049,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(23 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(22 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2073,8 +2072,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2089,18 +2088,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(25 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(24 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); From 11b1db50f8c534194d9db2a089099849052d0656 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:49:49 +0100 Subject: [PATCH 117/157] reference REL_14_11 cagg_union_view-* continuous_aggs-* transparent_decompression-* --- tsl/test/expected/cagg_union_view-14.out | 110 +++++++++++------------ tsl/test/expected/continuous_aggs-14.out | 50 +++++------ 2 files changed, 76 insertions(+), 84 deletions(-) diff --git a/tsl/test/expected/cagg_union_view-14.out b/tsl/test/expected/cagg_union_view-14.out index d352ee34b7b..d53b0825a20 100644 --- a/tsl/test/expected/cagg_union_view-14.out +++ b/tsl/test/expected/cagg_union_view-14.out @@ -355,31 +355,29 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=4 loops=1) Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) - -> Sort (actual rows=4 loops=1) + -> Merge Append (actual rows=4 loops=1) Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=4 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_6_chunk."time") - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(22 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(20 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -403,26 +401,24 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) -> Finalize GroupAggregate (actual rows=2 loops=1) Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) - -> Sort (actual rows=2 loops=1) + -> Merge Append (actual rows=2 loops=1) Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=2 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(17 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(15 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -592,8 +588,8 @@ ORDER by 1; -- plan output :PREFIX SELECT * FROM mat_m1 ORDER BY 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------- Sort (actual rows=3 loops=1) Sort Key: _hyper_9_15_chunk.time_bucket Sort Method: quicksort @@ -604,27 +600,25 @@ ORDER by 1; Group Key: (time_bucket(5, _hyper_7_11_chunk.a)) Filter: ((sum(_hyper_7_11_chunk.c) > 50) AND ((avg(_hyper_7_11_chunk.b))::integer > 12)) Rows Removed by Filter: 1 - -> Sort (actual rows=3 loops=1) + -> Merge Append (actual rows=3 loops=1) Sort Key: (time_bucket(5, _hyper_7_11_chunk.a)) - Sort Method: quicksort - -> Append (actual rows=3 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(5, _hyper_7_11_chunk.a) - -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(5, _hyper_7_13_chunk.a) - -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(5, _hyper_7_14_chunk.a) - -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) - Index Cond: (a >= 25) - Filter: ((b < 16) AND (c > 20)) - Rows Removed by Filter: 2 -(30 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_11_chunk.a) + -> Index Scan Backward using _hyper_7_11_chunk_ht_intdata_a_idx on _hyper_7_11_chunk (actual rows=2 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_13_chunk.a) + -> Index Scan Backward using _hyper_7_13_chunk_ht_intdata_a_idx on _hyper_7_13_chunk (actual rows=3 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(5, _hyper_7_14_chunk.a) + -> Index Scan Backward using _hyper_7_14_chunk_ht_intdata_a_idx on _hyper_7_14_chunk (actual rows=1 loops=1) + Index Cond: (a >= 25) + Filter: ((b < 16) AND (c > 20)) + Rows Removed by Filter: 2 +(28 rows) -- Test caggs with different time types CREATE TABLE smallint_table (time smallint, value int); diff --git a/tsl/test/expected/continuous_aggs-14.out b/tsl/test/expected/continuous_aggs-14.out index 478825ae14f..8e2289908d9 100644 --- a/tsl/test/expected/continuous_aggs-14.out +++ b/tsl/test/expected/continuous_aggs-14.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2049,18 +2049,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(23 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(22 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2073,8 +2072,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2089,18 +2088,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(25 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(24 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); From f9186eaef037afcc9a8a0451018312e69c0a5969 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:50:26 +0100 Subject: [PATCH 118/157] reference REL_16_4-111-g925b3aa857 cagg_union_view-* continuous_aggs-* transparent_decompression-* --- tsl/test/expected/cagg_union_view-16.out | 68 +++++++++++------------- tsl/test/expected/continuous_aggs-16.out | 50 +++++++++-------- 2 files changed, 56 insertions(+), 62 deletions(-) diff --git a/tsl/test/expected/cagg_union_view-16.out b/tsl/test/expected/cagg_union_view-16.out index 436a465c123..82256a15725 100644 --- a/tsl/test/expected/cagg_union_view-16.out +++ b/tsl/test/expected/cagg_union_view-16.out @@ -355,31 +355,29 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- first UNION child should have no rows because no materialization has happened yet and 2nd child should have 4 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate (actual rows=4 loops=1) Group Key: (time_bucket(10, _hyper_5_5_chunk."time")) - -> Sort (actual rows=4 loops=1) + -> Merge Append (actual rows=4 loops=1) Sort Key: (time_bucket(10, _hyper_5_5_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=4 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_5_chunk."time") - -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_6_chunk."time") - -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= '-2147483648'::integer) -(22 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_5_chunk."time") + -> Index Scan Backward using _hyper_5_5_chunk_boundary_test_time_idx on _hyper_5_5_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_6_chunk."time") + -> Index Scan Backward using _hyper_5_6_chunk_boundary_test_time_idx on _hyper_5_6_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= '-2147483648'::integer) +(20 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; @@ -403,26 +401,24 @@ SELECT _timescaledb_functions.cagg_watermark(:boundary_view_id); -- both sides of the UNION should return 2 rows :PREFIX SELECT * FROM boundary_view; - QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------- Append (actual rows=4 loops=1) -> Index Scan using _hyper_6_9_chunk__materialized_hypertable_6_time_bucket_idx on _hyper_6_9_chunk (actual rows=2 loops=1) Index Cond: (time_bucket < 30) -> Finalize GroupAggregate (actual rows=2 loops=1) Group Key: (time_bucket(10, _hyper_5_7_chunk."time")) - -> Sort (actual rows=2 loops=1) + -> Merge Append (actual rows=2 loops=1) Sort Key: (time_bucket(10, _hyper_5_7_chunk."time")) - Sort Method: quicksort - -> Append (actual rows=2 loops=1) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_7_chunk."time") - -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) - -> Partial GroupAggregate (actual rows=1 loops=1) - Group Key: time_bucket(10, _hyper_5_8_chunk."time") - -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) - Index Cond: ("time" >= 30) -(17 rows) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_7_chunk."time") + -> Index Scan Backward using _hyper_5_7_chunk_boundary_test_time_idx on _hyper_5_7_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) + -> Partial GroupAggregate (actual rows=1 loops=1) + Group Key: time_bucket(10, _hyper_5_8_chunk."time") + -> Index Scan Backward using _hyper_5_8_chunk_boundary_test_time_idx on _hyper_5_8_chunk (actual rows=1 loops=1) + Index Cond: ("time" >= 30) +(15 rows) -- result should have 4 rows SELECT * FROM boundary_view ORDER BY time_bucket; diff --git a/tsl/test/expected/continuous_aggs-16.out b/tsl/test/expected/continuous_aggs-16.out index 7a52c68c544..38804430ea2 100644 --- a/tsl/test/expected/continuous_aggs-16.out +++ b/tsl/test/expected/continuous_aggs-16.out @@ -2035,8 +2035,8 @@ SELECT * FROM mat_m1; -- Merge Append EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ Merge Append Sort Key: _hyper_59_123_chunk.sum DESC -> Merge Append @@ -2049,18 +2049,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(23 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(22 rows) -- Ordering by another column SELECT * FROM mat_m1 ORDER BY count; @@ -2073,8 +2072,8 @@ SELECT * FROM mat_m1 ORDER BY count; (4 rows) EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; - QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------ Sort Sort Key: _hyper_59_123_chunk.count -> Merge Append @@ -2089,18 +2088,17 @@ EXPLAIN (COSTS OFF) SELECT * FROM mat_m1 ORDER BY count; Sort Key: (sum(_hyper_52_111_chunk.temperature)) DESC -> Finalize GroupAggregate Group Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Sort + -> Merge Append Sort Key: (time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec)) - -> Append - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) - -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) - -> Partial GroupAggregate - Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) - -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk - Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) -(25 rows) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_111_chunk.timec) + -> Index Scan Backward using _hyper_52_111_chunk_conditions_timec_idx on _hyper_52_111_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) + -> Partial GroupAggregate + Group Key: time_bucket('@ 7 days'::interval, _hyper_52_125_chunk.timec) + -> Index Scan Backward using _hyper_52_125_chunk_conditions_timec_idx on _hyper_52_125_chunk + Index Cond: (timec >= 'Sun Nov 04 16:00:00 2018 PST'::timestamp with time zone) +(24 rows) -- Change the type of cagg ALTER MATERIALIZED VIEW mat_m1 SET (timescaledb.materialized_only=true); From fc4d4f45c21b05943a2c477e2aec01b7046299d4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:58:41 +0100 Subject: [PATCH 119/157] fixes --- src/planner/planner.c | 3 --- src/planner/planner.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/planner/planner.c b/src/planner/planner.c index c70a6c88ec9..0b07853b1ba 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -276,9 +276,6 @@ ts_rte_is_hypertable(const RangeTblEntry *rte) return ht != NULL; } -#define IS_UPDL_CMD(parse) \ - ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) - typedef struct { Query *rootquery; diff --git a/src/planner/planner.h b/src/planner/planner.h index e82ff36ac46..75b0bcca83a 100644 --- a/src/planner/planner.h +++ b/src/planner/planner.h @@ -24,6 +24,9 @@ */ #define PLANNER_LOCATION_MAGIC -29811 +#define IS_UPDL_CMD(parse) \ + ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) + typedef struct Chunk Chunk; typedef struct Hypertable Hypertable; typedef struct TimescaleDBPrivate From 62f061013429b0dfcdaecdd13d8532fed8fff078 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:24:25 +0100 Subject: [PATCH 120/157] fix debug --- tsl/src/nodes/decompress_chunk/decompress_chunk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index a329d81f102..6ab1a42e2c6 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -895,12 +895,12 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con chunk_rel->rows = new_row_estimate; create_compressed_scan_paths(root, compressed_rel, compression_info, &sort_info); - fprintf(stderr, - "sortinfo: seqnum %d, pushdown %d, reverse %d, compressed pks:\n", - sort_info.needs_sequence_num, - sort_info.can_pushdown_sort, - sort_info.reverse); - my_print(sort_info.required_compressed_pathkeys); +// fprintf(stderr, +// "sortinfo: seqnum %d, pushdown %d, reverse %d, compressed pks:\n", +// sort_info.needs_sequence_num, +// sort_info.can_pushdown_sort, +// sort_info.reverse); +// my_print(sort_info.required_compressed_pathkeys); /* compute parent relids of the chunk and use it to filter paths*/ Relids parent_relids = NULL; From 0f0c14e88e9638412fe788b1bddf5f286a407901 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 5 Dec 2024 20:15:04 +0100 Subject: [PATCH 121/157] vector agg memory test is fixed now --- .../nodes/decompress_chunk/decompress_chunk.c | 2 +- tsl/test/expected/vector_agg_memory.out | 34 +++++++------------ tsl/test/sql/vector_agg_memory.sql | 11 ++---- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 6ab1a42e2c6..b1882755c6b 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -1007,7 +1007,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con compressed_path->pathkeys)) { /* - * The decompressed path already has the required ordering. + * The compressed path already has the required ordering. */ DecompressChunkPath *path = (DecompressChunkPath *) chunk_path_no_sort; path->reverse = sort_info.reverse; diff --git a/tsl/test/expected/vector_agg_memory.out b/tsl/test/expected/vector_agg_memory.out index 1600fbba164..86faa1f54ad 100644 --- a/tsl/test/expected/vector_agg_memory.out +++ b/tsl/test/expected/vector_agg_memory.out @@ -72,34 +72,26 @@ select * from log where ( truncate log; set max_parallel_workers_per_gather = 0; set timescaledb.debug_require_vector_agg = 'require'; --- Despite the tweaks above, we are unable to force the HashAggregation, because --- the unsorted DecompressChunk paths for aggregation are not created properly --- (see issue #6836). Limit the memory consumed by tuplesort. -set work_mem = '64kB'; +-- We should reliably see HashAggregate here because of the tweaks we made above. explain (costs off) select ts_debug_allocated_bytes() bytes, count(*) a, count(t) b, sum(t) c, avg(t) d, min(t) e, max(t) f from mvagg where t >= -1 and t < 1000000 group by s1; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------- - Finalize GroupAggregate + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------- + Finalize HashAggregate Group Key: _hyper_1_1_chunk.s1 - -> Merge Append - Sort Key: _hyper_1_1_chunk.s1 + -> Append -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk Vectorized Filter: ((t >= '-1'::integer) AND (t < 1000000)) - -> Sort - Sort Key: compress_hyper_2_3_chunk.s1 - -> Seq Scan on compress_hyper_2_3_chunk - Filter: ((_ts_meta_max_1 >= '-1'::integer) AND (_ts_meta_min_1 < 1000000)) + -> Seq Scan on compress_hyper_2_3_chunk + Filter: ((_ts_meta_max_1 >= '-1'::integer) AND (_ts_meta_min_1 < 1000000)) -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk Vectorized Filter: ((t >= '-1'::integer) AND (t < 1000000)) - -> Sort - Sort Key: compress_hyper_2_4_chunk.s1 - -> Index Scan using compress_hyper_2_4_chunk_s0_s1__ts_meta_min_1__ts_meta_max__idx on compress_hyper_2_4_chunk - Index Cond: ((_ts_meta_min_1 < 1000000) AND (_ts_meta_max_1 >= '-1'::integer)) -(18 rows) + -> Index Scan using compress_hyper_2_4_chunk_s0_s1__ts_meta_min_1__ts_meta_max__idx on compress_hyper_2_4_chunk + Index Cond: ((_ts_meta_min_1 < 1000000) AND (_ts_meta_max_1 >= '-1'::integer)) +(13 rows) \set ECHO none reset timescaledb.debug_require_vector_agg; @@ -108,10 +100,8 @@ reset work_mem; select * from log where ( -- For aggregation by segmentby, memory usage should be constant regardless -- of the number of tuples. Still, we have to allow for small variations - -- that can be caused by other reasons. Currently the major increase is - -- caused by tuplesort, because we are unable to force hash aggregation due - -- to unrelated planning bugs. - select regr_slope(bytes, n) > 0.05 from log + -- that can be caused by other reasons. + select regr_slope(bytes, n) > 0.01 from log ); n | bytes | a | b | c | d | e | f ---+-------+---+---+---+---+---+--- diff --git a/tsl/test/sql/vector_agg_memory.sql b/tsl/test/sql/vector_agg_memory.sql index 84a32071319..97a720006a5 100644 --- a/tsl/test/sql/vector_agg_memory.sql +++ b/tsl/test/sql/vector_agg_memory.sql @@ -63,11 +63,8 @@ select * from log where ( truncate log; set max_parallel_workers_per_gather = 0; set timescaledb.debug_require_vector_agg = 'require'; --- Despite the tweaks above, we are unable to force the HashAggregation, because --- the unsorted DecompressChunk paths for aggregation are not created properly --- (see issue #6836). Limit the memory consumed by tuplesort. -set work_mem = '64kB'; +-- We should reliably see HashAggregate here because of the tweaks we made above. explain (costs off) select ts_debug_allocated_bytes() bytes, count(*) a, count(t) b, sum(t) c, avg(t) d, min(t) e, max(t) f from mvagg where t >= -1 and t < 1000000 group by s1; @@ -90,10 +87,8 @@ reset work_mem; select * from log where ( -- For aggregation by segmentby, memory usage should be constant regardless -- of the number of tuples. Still, we have to allow for small variations - -- that can be caused by other reasons. Currently the major increase is - -- caused by tuplesort, because we are unable to force hash aggregation due - -- to unrelated planning bugs. - select regr_slope(bytes, n) > 0.05 from log + -- that can be caused by other reasons. + select regr_slope(bytes, n) > 0.01 from log ); reset timescaledb.debug_require_vector_agg; From 455e92b837062afa6e74afd028e05dce416df93a Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 9 Dec 2024 13:18:24 +0100 Subject: [PATCH 122/157] benchmark chunkwise aggregation path changes (2024-12-09 no. 1) From c7c8f60191e5d75ab21c8428757e93667c5b82e1 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:30:12 +0100 Subject: [PATCH 123/157] reference REL_15_7 transparent_decompression-* --- tsl/test/expected/transparent_decompression-15.out | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tsl/test/expected/transparent_decompression-15.out b/tsl/test/expected/transparent_decompression-15.out index 07e2b8d01c3..5677fa7d695 100644 --- a/tsl/test/expected/transparent_decompression-15.out +++ b/tsl/test/expected/transparent_decompression-15.out @@ -5628,15 +5628,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5646,7 +5643,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (35 rows) -- test window functions with GROUP BY @@ -5674,15 +5670,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5692,7 +5685,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (36 rows) SET enable_hashagg = ON; From 75c85159b4115e797df9c0930111d46446a7c557 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:06:36 +0100 Subject: [PATCH 124/157] cleanup --- .../nodes/decompress_chunk/decompress_chunk.c | 106 ++++++++---------- .../expected/recompress_chunk_segmentwise.out | 2 +- 2 files changed, 46 insertions(+), 62 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index b1882755c6b..351f12ab8d7 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -895,12 +895,6 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con chunk_rel->rows = new_row_estimate; create_compressed_scan_paths(root, compressed_rel, compression_info, &sort_info); -// fprintf(stderr, -// "sortinfo: seqnum %d, pushdown %d, reverse %d, compressed pks:\n", -// sort_info.needs_sequence_num, -// sort_info.can_pushdown_sort, -// sort_info.reverse); -// my_print(sort_info.required_compressed_pathkeys); /* compute parent relids of the chunk and use it to filter paths*/ Relids parent_relids = NULL; @@ -993,7 +987,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con Path *chunk_path_no_sort = (Path *) decompress_chunk_path_create(root, compression_info, 0, compressed_path); - List *chunk_paths = list_make1(chunk_path_no_sort); + List *decompressed_paths = list_make1(chunk_path_no_sort); /* * If we can push down the sort below the DecompressChunk node, we set the pathkeys of @@ -1007,7 +1001,8 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con compressed_path->pathkeys)) { /* - * The compressed path already has the required ordering. + * The compressed path already has the required ordering. Modify + * in place the no-sorting path we just created above. */ DecompressChunkPath *path = (DecompressChunkPath *) chunk_path_no_sort; path->reverse = sort_info.reverse; @@ -1019,7 +1014,8 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con { /* * We must sort the underlying compressed path to get the - * required ordering. + * required ordering. Make a copy of no-sorting path and modify + * it accordingly */ DecompressChunkPath *path_copy = copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); @@ -1048,7 +1044,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con cost_decompress_chunk(root, &path_copy->custom_path.path, &sort_path); - chunk_paths = lappend(chunk_paths, path_copy); + decompressed_paths = lappend(decompressed_paths, path_copy); } } else if (ts_guc_enable_decompression_sorted_merge) @@ -1078,41 +1074,34 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con path_copy->custom_path.path.pathkeys = root->query_pathkeys; cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); - chunk_paths = lappend(chunk_paths, path_copy); + decompressed_paths = lappend(decompressed_paths, path_copy); } } - (void) make_chunk_sorted_path; /* - * Add useful sorted versions of the decompress path, if we couldn't - * push down the sort. + * Add sorted version of the decompress path, if we couldn't push down + * the sort. */ - Path *sort_above_chunk = make_chunk_sorted_path(root, - chunk_rel, - ht, - ht_relid, - chunk_path_no_sort, - compressed_path); - (void) sort_above_chunk; - if (sort_above_chunk != NULL) + if (!sort_info.can_pushdown_sort) { - chunk_paths = lappend(chunk_paths, sort_above_chunk); - } - - if (!add_uncompressed_part) - { - ListCell *chunk_paths_cell; - foreach (chunk_paths_cell, chunk_paths) + Path *sort_above_chunk = make_chunk_sorted_path(root, + chunk_rel, + ht, + ht_relid, + chunk_path_no_sort, + compressed_path); + if (sort_above_chunk != NULL) { - add_path(chunk_rel, lfirst(chunk_paths_cell)); + decompressed_paths = lappend(decompressed_paths, sort_above_chunk); } } - else + + /* + * If this is a partially compressed chunk we have to combine data + * from compressed and uncompressed chunk. + */ + if (add_uncompressed_part) { - /* - * If this is a partially compressed chunk we have to combine data - * from compressed and uncompressed chunk. - */ Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); Path *uncompressed_path = get_cheapest_path_for_pathkeys(initial_pathlist, NIL, req_outer, TOTAL_COST, false); @@ -1130,40 +1119,25 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con continue; } - ListCell *chunk_paths_cell; - foreach (chunk_paths_cell, chunk_paths) + ListCell *lc; + foreach (lc, decompressed_paths) { /* - * If we were able to generate a batch merge path, create a merge append path - * that combines the result of the compressed and uncompressed part of the chunk. - * The uncompressed part will be sorted, the batch_merge_path is already properly - * sorted. - */ - Path *path = lfirst(chunk_paths_cell); - // path = (Path *) create_merge_append_path_compat(root, - // chunk_rel, - // list_make2(path, - // uncompressed_path), - // path->pathkeys, - // req_outer, - // NIL); - /* - * The per-chunk append paths are going to be accumulated - * into a per-hypertable append path by - * accumulate_append_subpath(), and it will try to create - * MergeAppend paths if some child paths have pathkeys, so - * here it is enough to create a plain Append path. + * Combine decompressed path with uncompressed part of the chunk, + * using either MergeAppend or plain Append, depending on + * whether it has sorting. */ + Path *path = lfirst(lc); if (path->pathkeys == NIL) { path = (Path *) create_append_path(root, chunk_rel, list_make2(path, uncompressed_path), - NIL /* partial paths */, - NIL, // path->pathkeys, + /* partial_subpaths = */ NIL, + /* pathkeys = */ NIL, req_outer, - 0, - false, + /* parallel_workers = */ 0, + /* parallel_aware = */ false, path->rows + uncompressed_path->rows); } else @@ -1174,14 +1148,24 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con path->pathkeys, req_outer); } - add_path(chunk_rel, path); + + lfirst(lc) = path; } } + + /* + * Add the paths to the chunk relation. + */ + foreach (lc, decompressed_paths) + { + add_path(chunk_rel, lfirst(lc)); + } } /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed * if it's planned */ compressed_rel->pathlist = NIL; + /* create parallel paths */ if (compressed_rel->consider_parallel) { diff --git a/tsl/test/expected/recompress_chunk_segmentwise.out b/tsl/test/expected/recompress_chunk_segmentwise.out index db795bbe76f..c60948eb1b9 100644 --- a/tsl/test/expected/recompress_chunk_segmentwise.out +++ b/tsl/test/expected/recompress_chunk_segmentwise.out @@ -130,9 +130,9 @@ select * from :chunk_to_compress_2 ORDER BY a, c, time DESC; time | a | b | c -------------------------------------+---+---+--- Sun Jan 01 11:56:20.048355 2023 PST | 2 | | 2 + Sun Jan 01 09:56:20.048355 2023 PST | 2 | | 2 Sun Jan 01 11:57:20.048355 2023 PST | 3 | | 3 Sun Jan 01 11:56:20.048355 2023 PST | 3 | | 3 - Sun Jan 01 09:56:20.048355 2023 PST | 2 | | 2 (4 rows) SELECT compressed_chunk_schema || '.' || compressed_chunk_name as compressed_chunk_name_2 From 37bb9194f016cf92888f14fa0d3054a6a433153d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:09:08 +0100 Subject: [PATCH 125/157] cleanup --- tsl/src/nodes/decompress_chunk/decompress_chunk.c | 3 --- tsl/test/expected/transparent_decompression-14.out | 8 -------- 2 files changed, 11 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 351f12ab8d7..69b18e240c7 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -813,9 +813,6 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertabl Path *sorted_path = (Path *) create_sort_path(root, chunk_rel, (Path *) path_copy, useful_pathkeys, root->limit_tuples); - // fprintf(stderr, "made useful sorted path:\n"); - // my_print(sorted_path); - return sorted_path; } diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 8073ed7ef7a..6f7935e9e32 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -5628,15 +5628,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5646,7 +5643,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (35 rows) -- test window functions with GROUP BY @@ -5674,15 +5670,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5692,7 +5685,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (36 rows) SET enable_hashagg = ON; From cc52ef24641db56d9d21803ecede7314f80f4774 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:12:03 +0100 Subject: [PATCH 126/157] reference REL_17_0-80-gb7467ab71c transparent_decompression-* merge_append_partially_compressed-* --- .../merge_append_partially_compressed-17.out | 136 +++++++----------- .../expected/transparent_decompression-17.out | 89 +++++------- 2 files changed, 90 insertions(+), 135 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-17.out b/tsl/test/expected/merge_append_partially_compressed-17.out index 86fc416f7a8..a47b13e0180 100644 --- a/tsl/test/expected/merge_append_partially_compressed-17.out +++ b/tsl/test/expected/merge_append_partially_compressed-17.out @@ -76,39 +76,25 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Merge Append (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=81 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) - -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=84 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) - -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) -(33 rows) + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) +(19 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -148,48 +134,32 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',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: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC - -> Merge Append (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Result (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Result (never executed) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) - -> Seq Scan on compress_hyper_2_5_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Seq Scan on _hyper_1_2_chunk (never executed) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Result (never executed) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) - -> Seq Scan on compress_hyper_2_4_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Seq Scan on _hyper_1_1_chunk (never executed) -(35 rows) + Sort Method: top-N heapsort + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) +(19 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,8 +170,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort @@ -213,8 +183,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -225,8 +195,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC -> Seq Scan on _hyper_1_1_chunk (never executed) @@ -234,8 +204,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,8 +216,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + Filter: (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 Sort Method: top-N heapsort @@ -259,8 +229,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -271,8 +241,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_6_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Seq Scan on _hyper_1_3_chunk (never executed) diff --git a/tsl/test/expected/transparent_decompression-17.out b/tsl/test/expected/transparent_decompression-17.out index b7a899a1405..5b870a639f9 100644 --- a/tsl/test/expected/transparent_decompression-17.out +++ b/tsl/test/expected/transparent_decompression-17.out @@ -1508,28 +1508,23 @@ ORDER BY device_id DESC, time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=2235 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 - Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Rows Removed by Filter: 1125 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 - Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, 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 DESC, compress_hyper_5_16_chunk._ts_meta_max_2 DESC, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 + Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- should not produce ordered path :PREFIX_VERBOSE @@ -5366,43 +5361,41 @@ ORDER BY device_id DESC, time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=447 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 - Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, 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 DESC, compress_hyper_6_20_chunk._ts_meta_max_2 DESC, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 + Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1008 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 - -> Sort (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, 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 DESC, compress_hyper_6_21_chunk._ts_meta_max_2 DESC, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(36 rows) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(34 rows) -- should not produce ordered path :PREFIX_VERBOSE @@ -5628,15 +5621,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5646,7 +5636,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (35 rows) -- test window functions with GROUP BY @@ -5674,15 +5663,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5692,7 +5678,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (36 rows) SET enable_hashagg = ON; From 7cc64eee688ad007d6e2487d7d0ba19e6b337031 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:25:42 +0100 Subject: [PATCH 127/157] add a test for another fixed issue --- .../merge_append_partially_compressed-14.out | 52 +++++++++++++++++++ .../merge_append_partially_compressed-15.out | 52 +++++++++++++++++++ .../merge_append_partially_compressed-16.out | 52 +++++++++++++++++++ .../merge_append_partially_compressed-17.out | 52 +++++++++++++++++++ .../merge_append_partially_compressed.sql.in | 14 +++++ 5 files changed, 222 insertions(+) diff --git a/tsl/test/expected/merge_append_partially_compressed-14.out b/tsl/test/expected/merge_append_partially_compressed-14.out index 9e6623fa073..fcf8cd20cd1 100644 --- a/tsl/test/expected/merge_append_partially_compressed-14.out +++ b/tsl/test/expected/merge_append_partially_compressed-14.out @@ -490,6 +490,58 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC Filter: (device = ANY ('{1,2,3}'::integer[])) (39 rows) +-- Test direct ordered select from a single partially compressed chunk +select * from show_chunks('ht_metrics_compressed') chunk order by chunk limit 1 \gset +:PREFIX +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + time | device | value +------------------------------+--------+------- + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 06:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 09:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 12:00:00 2020 PST | 1 | 0.1 +(5 rows) + +:PREFIX +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + time | device | value +------------------------------+--------+------- + Wed Jan 08 12:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 09:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 06:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 +(5 rows) + CREATE TABLE test1 ( time timestamptz NOT NULL, x1 integer, diff --git a/tsl/test/expected/merge_append_partially_compressed-15.out b/tsl/test/expected/merge_append_partially_compressed-15.out index a47b13e0180..714bfd5706f 100644 --- a/tsl/test/expected/merge_append_partially_compressed-15.out +++ b/tsl/test/expected/merge_append_partially_compressed-15.out @@ -466,6 +466,58 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC Filter: (device = ANY ('{1,2,3}'::integer[])) (39 rows) +-- Test direct ordered select from a single partially compressed chunk +select * from show_chunks('ht_metrics_compressed') chunk order by chunk limit 1 \gset +:PREFIX +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + time | device | value +------------------------------+--------+------- + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 06:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 09:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 12:00:00 2020 PST | 1 | 0.1 +(5 rows) + +:PREFIX +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + time | device | value +------------------------------+--------+------- + Wed Jan 08 12:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 09:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 06:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 +(5 rows) + CREATE TABLE test1 ( time timestamptz NOT NULL, x1 integer, diff --git a/tsl/test/expected/merge_append_partially_compressed-16.out b/tsl/test/expected/merge_append_partially_compressed-16.out index 86fc416f7a8..b567c03b29f 100644 --- a/tsl/test/expected/merge_append_partially_compressed-16.out +++ b/tsl/test/expected/merge_append_partially_compressed-16.out @@ -496,6 +496,58 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC Filter: (device = ANY ('{1,2,3}'::integer[])) (39 rows) +-- Test direct ordered select from a single partially compressed chunk +select * from show_chunks('ht_metrics_compressed') chunk order by chunk limit 1 \gset +:PREFIX +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + time | device | value +------------------------------+--------+------- + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 06:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 09:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 12:00:00 2020 PST | 1 | 0.1 +(5 rows) + +:PREFIX +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + time | device | value +------------------------------+--------+------- + Wed Jan 08 12:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 09:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 06:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 +(5 rows) + CREATE TABLE test1 ( time timestamptz NOT NULL, x1 integer, diff --git a/tsl/test/expected/merge_append_partially_compressed-17.out b/tsl/test/expected/merge_append_partially_compressed-17.out index a47b13e0180..714bfd5706f 100644 --- a/tsl/test/expected/merge_append_partially_compressed-17.out +++ b/tsl/test/expected/merge_append_partially_compressed-17.out @@ -466,6 +466,58 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC Filter: (device = ANY ('{1,2,3}'::integer[])) (39 rows) +-- Test direct ordered select from a single partially compressed chunk +select * from show_chunks('ht_metrics_compressed') chunk order by chunk limit 1 \gset +:PREFIX +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=3 loops=1) + -> Index Scan using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=3 loops=1) + Sort Key: _hyper_1_1_chunk.device, _hyper_1_1_chunk."time" + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + time | device | value +------------------------------+--------+------- + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 00:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 06:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 09:00:00 2020 PST | 1 | 0.1 + Thu Jan 02 12:00:00 2020 PST | 1 | 0.1 +(5 rows) + +:PREFIX +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (actual rows=5 loops=1) + -> Merge Append (actual rows=5 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=4 loops=1) + -> Index Scan Backward using compress_hyper_2_4_chunk_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=1 loops=1) + -> Sort (actual rows=2 loops=1) + Sort Key: _hyper_1_1_chunk.device DESC, _hyper_1_1_chunk."time" DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) +(9 rows) + +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + time | device | value +------------------------------+--------+------- + Wed Jan 08 12:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 09:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 06:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 + Wed Jan 08 00:00:00 2020 PST | 3 | 0.3 +(5 rows) + CREATE TABLE test1 ( time timestamptz NOT NULL, x1 integer, diff --git a/tsl/test/sql/merge_append_partially_compressed.sql.in b/tsl/test/sql/merge_append_partially_compressed.sql.in index a75aa16e78c..11fcf0be4e8 100644 --- a/tsl/test/sql/merge_append_partially_compressed.sql.in +++ b/tsl/test/sql/merge_append_partially_compressed.sql.in @@ -47,6 +47,20 @@ SELECT * FROM ht_metrics_compressed WHERE device = 3 ORDER BY time, device DESC :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY device, time DESC LIMIT 1; -- with pushdown :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY device, time DESC LIMIT 1; -- with pushdown +-- Test direct ordered select from a single partially compressed chunk +select * from show_chunks('ht_metrics_compressed') chunk order by chunk limit 1 \gset + +:PREFIX +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + +SELECT * FROM :chunk ORDER BY device, time LIMIT 5; + +:PREFIX +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + +SELECT * FROM :chunk ORDER BY device DESC, time DESC LIMIT 5; + + CREATE TABLE test1 ( time timestamptz NOT NULL, x1 integer, From 2bce2accb943e3984d23c9567c450cdb5df72a0f Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:55:29 +0100 Subject: [PATCH 128/157] cleanup --- .../nodes/decompress_chunk/decompress_chunk.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 69b18e240c7..2a6ba14809a 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -760,12 +760,7 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertabl return NULL; } - /* Copy the decompress chunk path because the original can be recycled in add_path, and our - * sorted path must be independent. */ - if (!ts_is_decompress_chunk_path(path)) - { - return NULL; - } + Assert(ts_is_decompress_chunk_path(path)); /* Iterate over the sort_pathkeys and generate all possible useful sorting */ List *useful_pathkeys = NIL; @@ -802,12 +797,16 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertabl return NULL; } - /* Create the sorted path for these useful_pathkeys */ - if (pathkeys_contained_in(useful_pathkeys, path->pathkeys)) - { - return NULL; - } + /* + * We should be given an unsorted DecompressChunk path. + */ + Assert(path->pathkeys == NIL); + /* + * Create the sorted path for these useful_pathkeys. Copy the decompress + * chunk path because the original can be recycled in add_path, and our + * sorted path must be independent. + */ DecompressChunkPath *path_copy = copy_decompress_chunk_path((DecompressChunkPath *) path); Path *sorted_path = (Path *) From 705c43ff16233e6ad929311720af902db50da8db Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:57:23 +0100 Subject: [PATCH 129/157] reference REL_14_11 transparent_decompression-* merge_append_partially_compressed-* --- .../merge_append_partially_compressed-14.out | 130 +++++++----------- .../expected/transparent_decompression-14.out | 81 +++++------ 2 files changed, 90 insertions(+), 121 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-14.out b/tsl/test/expected/merge_append_partially_compressed-14.out index fcf8cd20cd1..03c903172b4 100644 --- a/tsl/test/expected/merge_append_partially_compressed-14.out +++ b/tsl/test/expected/merge_append_partially_compressed-14.out @@ -76,36 +76,25 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Merge Append (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - -> Sort (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) - -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) - -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) -(30 rows) + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) +(19 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -145,45 +134,32 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',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: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC - -> Merge Append (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) - -> Seq Scan on compress_hyper_2_5_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Seq Scan on _hyper_1_2_chunk (never executed) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) - -> Seq Scan on compress_hyper_2_4_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Seq Scan on _hyper_1_1_chunk (never executed) -(32 rows) + Sort Method: top-N heapsort + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) +(19 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,8 +170,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort @@ -207,8 +183,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -219,8 +195,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC -> Seq Scan on _hyper_1_1_chunk (never executed) @@ -228,8 +204,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,8 +216,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + Filter: (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 Sort Method: top-N heapsort @@ -253,8 +229,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -265,8 +241,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_6_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Seq Scan on _hyper_1_3_chunk (never executed) diff --git a/tsl/test/expected/transparent_decompression-14.out b/tsl/test/expected/transparent_decompression-14.out index 6f7935e9e32..b26fd211c4f 100644 --- a/tsl/test/expected/transparent_decompression-14.out +++ b/tsl/test/expected/transparent_decompression-14.out @@ -1508,28 +1508,23 @@ ORDER BY device_id DESC, time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=2235 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 - Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Rows Removed by Filter: 1125 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 - Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, 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 DESC, compress_hyper_5_16_chunk._ts_meta_max_2 DESC, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 + Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- should not produce ordered path :PREFIX_VERBOSE @@ -5366,43 +5361,41 @@ ORDER BY device_id DESC, time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=447 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 - Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, 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 DESC, compress_hyper_6_20_chunk._ts_meta_max_2 DESC, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 + Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1008 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 - -> Sort (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, 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 DESC, compress_hyper_6_21_chunk._ts_meta_max_2 DESC, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(36 rows) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(34 rows) -- should not produce ordered path :PREFIX_VERBOSE From bbbd8ebbf7abd6915fa2544bdebe45e7f8aa8e07 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:59:17 +0100 Subject: [PATCH 130/157] reference REL_16_4-111-g925b3aa857 transparent_decompression-* merge_append_partially_compressed-* --- .../merge_append_partially_compressed-16.out | 136 +++++++----------- .../expected/transparent_decompression-16.out | 89 +++++------- 2 files changed, 90 insertions(+), 135 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-16.out b/tsl/test/expected/merge_append_partially_compressed-16.out index b567c03b29f..714bfd5706f 100644 --- a/tsl/test/expected/merge_append_partially_compressed-16.out +++ b/tsl/test/expected/merge_append_partially_compressed-16.out @@ -76,39 +76,25 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Merge Append (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=81 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) - -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=84 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) - -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Result (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) -(33 rows) + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) +(19 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -148,48 +134,32 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',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: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC - -> Merge Append (actual rows=1 loops=1) + -> Gather Merge (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + -> Sort (actual rows=0 loops=2) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Result (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) - -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Result (never executed) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) - -> Seq Scan on compress_hyper_2_5_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC - -> Seq Scan on _hyper_1_2_chunk (never executed) - -> Merge Append (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Result (never executed) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) - -> Seq Scan on compress_hyper_2_4_chunk (never executed) - -> Sort (never executed) - Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC - -> Seq Scan on _hyper_1_1_chunk (never executed) -(35 rows) + Sort Method: top-N heapsort + Worker 0: Sort Method: quicksort + -> Result (actual rows=162 loops=2) + -> Append (actual rows=162 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) + -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) + -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) + -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) + -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) +(19 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,8 +170,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_6_chunk (actual rows=3 loops=1) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (actual rows=1 loops=1) Sort Key: _hyper_1_3_chunk."time" DESC Sort Method: top-N heapsort @@ -213,8 +183,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time" DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -225,8 +195,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_1_chunk."time" DESC -> Seq Scan on _hyper_1_1_chunk (never executed) @@ -234,8 +204,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,8 +216,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_4_chunk (actual rows=3 loops=1) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + Filter: (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 Sort Method: top-N heapsort @@ -259,8 +229,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_5_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_2_chunk."time", _hyper_1_2_chunk.device DESC -> Seq Scan on _hyper_1_2_chunk (never executed) @@ -271,8 +241,8 @@ 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_device__ts_meta_min_1__ts_meta_max_idx on compress_hyper_2_6_chunk (never executed) - Index Cond: (device = ANY ('{1,2,3}'::integer[])) + -> Seq Scan on compress_hyper_2_6_chunk (never executed) + Filter: (device = ANY ('{1,2,3}'::integer[])) -> Sort (never executed) Sort Key: _hyper_1_3_chunk."time", _hyper_1_3_chunk.device DESC -> Seq Scan on _hyper_1_3_chunk (never executed) diff --git a/tsl/test/expected/transparent_decompression-16.out b/tsl/test/expected/transparent_decompression-16.out index b7a899a1405..5b870a639f9 100644 --- a/tsl/test/expected/transparent_decompression-16.out +++ b/tsl/test/expected/transparent_decompression-16.out @@ -1508,28 +1508,23 @@ ORDER BY device_id DESC, time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 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 Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - -> Sort (actual rows=2235 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 - Sort Key: _hyper_1_2_chunk.device_id DESC, _hyper_1_2_chunk.device_id_peer DESC, _hyper_1_2_chunk.v0, _hyper_1_2_chunk.v1 DESC, _hyper_1_2_chunk."time" - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) -> Seq Scan on _timescaledb_internal._hyper_1_2_chunk (actual rows=2235 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."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) Rows Removed by Filter: 1125 - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 - Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=5 loops=1) - Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 - Sort Key: compress_hyper_5_16_chunk.device_id DESC, compress_hyper_5_16_chunk.device_id_peer DESC, 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 DESC, compress_hyper_5_16_chunk._ts_meta_max_2 DESC, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3 - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk (actual rows=1680 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 + Vectorized Filter: (_hyper_1_3_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_5_16_chunk (actual rows=5 loops=1) Output: compress_hyper_5_16_chunk._ts_meta_count, compress_hyper_5_16_chunk.device_id, compress_hyper_5_16_chunk.device_id_peer, compress_hyper_5_16_chunk._ts_meta_min_3, compress_hyper_5_16_chunk._ts_meta_max_3, compress_hyper_5_16_chunk."time", compress_hyper_5_16_chunk._ts_meta_min_1, compress_hyper_5_16_chunk._ts_meta_max_1, compress_hyper_5_16_chunk.v0, compress_hyper_5_16_chunk._ts_meta_min_2, compress_hyper_5_16_chunk._ts_meta_max_2, compress_hyper_5_16_chunk.v1, compress_hyper_5_16_chunk.v2, compress_hyper_5_16_chunk.v3 Filter: (compress_hyper_5_16_chunk._ts_meta_max_3 > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(21 rows) +(16 rows) -- should not produce ordered path :PREFIX_VERBOSE @@ -5366,43 +5361,41 @@ ORDER BY device_id DESC, time; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Merge Append (actual rows=3915 loops=1) + Sort (actual rows=3915 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 Sort Key: _hyper_2_7_chunk.device_id DESC, _hyper_2_7_chunk.device_id_peer DESC, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1 DESC, _hyper_2_7_chunk."time" - -> 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=447 loops=1) - Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 - Index Cond: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) - Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 - Index Cond: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Index Scan using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) - Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 - Index Cond: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 - Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) - Bulk Decompression: true - -> Sort (actual rows=1 loops=1) - Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 - Sort Key: compress_hyper_6_20_chunk.device_id DESC, compress_hyper_6_20_chunk.device_id_peer DESC, 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 DESC, compress_hyper_6_20_chunk._ts_meta_max_2 DESC, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3 - Sort Method: quicksort + Sort Method: quicksort + -> Append (actual rows=3915 loops=1) + -> Seq Scan on _timescaledb_internal._hyper_2_7_chunk (actual rows=447 loops=1) + Output: _hyper_2_7_chunk."time", _hyper_2_7_chunk.device_id, _hyper_2_7_chunk.device_id_peer, _hyper_2_7_chunk.v0, _hyper_2_7_chunk.v1, _hyper_2_7_chunk.v2, _hyper_2_7_chunk.v3 + Filter: (_hyper_2_7_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Seq Scan on _timescaledb_internal._hyper_2_8_chunk (actual rows=1341 loops=1) + Output: _hyper_2_8_chunk."time", _hyper_2_8_chunk.device_id, _hyper_2_8_chunk.device_id_peer, _hyper_2_8_chunk.v0, _hyper_2_8_chunk.v1, _hyper_2_8_chunk.v2, _hyper_2_8_chunk.v3 + Filter: (_hyper_2_8_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 675 + -> Seq Scan on _timescaledb_internal._hyper_2_9_chunk (actual rows=447 loops=1) + Output: _hyper_2_9_chunk."time", _hyper_2_9_chunk.device_id, _hyper_2_9_chunk.device_id_peer, _hyper_2_9_chunk.v0, _hyper_2_9_chunk.v1, _hyper_2_9_chunk.v2, _hyper_2_9_chunk.v3 + Filter: (_hyper_2_9_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Rows Removed by Filter: 225 + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_10_chunk (actual rows=336 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 + Vectorized Filter: (_hyper_2_10_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) + Bulk Decompression: true -> Seq Scan on _timescaledb_internal.compress_hyper_6_20_chunk (actual rows=1 loops=1) Output: compress_hyper_6_20_chunk._ts_meta_count, compress_hyper_6_20_chunk.device_id, compress_hyper_6_20_chunk.device_id_peer, compress_hyper_6_20_chunk._ts_meta_min_3, compress_hyper_6_20_chunk._ts_meta_max_3, compress_hyper_6_20_chunk."time", compress_hyper_6_20_chunk._ts_meta_min_1, compress_hyper_6_20_chunk._ts_meta_max_1, compress_hyper_6_20_chunk.v0, compress_hyper_6_20_chunk._ts_meta_min_2, compress_hyper_6_20_chunk._ts_meta_max_2, compress_hyper_6_20_chunk.v1, compress_hyper_6_20_chunk.v2, compress_hyper_6_20_chunk.v3 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=1008 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 - -> Sort (actual rows=3 loops=1) - Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 - Sort Key: compress_hyper_6_21_chunk.device_id DESC, compress_hyper_6_21_chunk.device_id_peer DESC, 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 DESC, compress_hyper_6_21_chunk._ts_meta_max_2 DESC, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3 - Sort Method: quicksort + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_2_11_chunk (actual rows=1008 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 -> Seq Scan on _timescaledb_internal.compress_hyper_6_21_chunk (actual rows=3 loops=1) Output: compress_hyper_6_21_chunk._ts_meta_count, compress_hyper_6_21_chunk.device_id, compress_hyper_6_21_chunk.device_id_peer, compress_hyper_6_21_chunk._ts_meta_min_3, compress_hyper_6_21_chunk._ts_meta_max_3, compress_hyper_6_21_chunk."time", compress_hyper_6_21_chunk._ts_meta_min_1, compress_hyper_6_21_chunk._ts_meta_max_1, compress_hyper_6_21_chunk.v0, compress_hyper_6_21_chunk._ts_meta_min_2, compress_hyper_6_21_chunk._ts_meta_max_2, compress_hyper_6_21_chunk.v1, compress_hyper_6_21_chunk.v2, compress_hyper_6_21_chunk.v3 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_v_2 on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) - Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 - Index Cond: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) -(36 rows) + -> Seq Scan on _timescaledb_internal._hyper_2_12_chunk (actual rows=336 loops=1) + Output: _hyper_2_12_chunk."time", _hyper_2_12_chunk.device_id, _hyper_2_12_chunk.device_id_peer, _hyper_2_12_chunk.v0, _hyper_2_12_chunk.v1, _hyper_2_12_chunk.v2, _hyper_2_12_chunk.v3 + Filter: (_hyper_2_12_chunk."time" > 'Sat Jan 08 00:00:00 2000 PST'::timestamp with time zone) +(34 rows) -- should not produce ordered path :PREFIX_VERBOSE @@ -5628,15 +5621,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5646,7 +5636,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (35 rows) -- test window functions with GROUP BY @@ -5674,15 +5663,12 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_7_chunk.device_id -> Index Only Scan Backward using _hyper_2_7_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_7_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=3 loops=1) Group Key: _hyper_2_8_chunk.device_id -> Index Only Scan Backward using _hyper_2_8_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_8_chunk (actual rows=2016 loops=1) - Heap Fetches: 0 -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_9_chunk.device_id -> Index Only Scan Backward using _hyper_2_9_chunk_metrics_space_device_id_device_id_peer_v0_v1_2 on _hyper_2_9_chunk (actual rows=672 loops=1) - Heap Fetches: 0 -> Custom Scan (VectorAgg) (actual rows=1 loops=1) -> Custom Scan (DecompressChunk) on _hyper_2_10_chunk (actual rows=336 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) @@ -5692,7 +5678,6 @@ ORDER BY device_id; -> Partial GroupAggregate (actual rows=1 loops=1) Group Key: _hyper_2_12_chunk.device_id -> Index Only Scan Backward using _hyper_2_12_chunk_metrics_space_device_id_device_id_peer_v0_v_2 on _hyper_2_12_chunk (actual rows=336 loops=1) - Heap Fetches: 0 (36 rows) SET enable_hashagg = ON; From 6865182d444a4b3dac5abff1d9dc3b2acf336e70 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:30:41 +0100 Subject: [PATCH 131/157] fix MergeAppend with sorting by time_bucket --- .../nodes/decompress_chunk/decompress_chunk.c | 6 - .../merge_append_partially_compressed-15.out | 104 +++++++++++------- 2 files changed, 67 insertions(+), 43 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 2a6ba14809a..dfad5b5cb69 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -783,12 +783,6 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertabl break; } - /* We are only interested in sorting if this is a var */ - if (!IsA(em_expr, Var)) - { - break; - } - useful_pathkeys = lappend(useful_pathkeys, pathkey); } diff --git a/tsl/test/expected/merge_append_partially_compressed-15.out b/tsl/test/expected/merge_append_partially_compressed-15.out index 714bfd5706f..0806da68bd1 100644 --- a/tsl/test/expected/merge_append_partially_compressed-15.out +++ b/tsl/test/expected/merge_append_partially_compressed-15.out @@ -76,25 +76,39 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=81 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) -(19 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=84 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) + -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) +(33 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -134,28 +148,44 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',time) DESC LIMIT 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC + -> Merge Append (actual rows=1 loops=1) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Result (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Seq Scan on _hyper_1_2_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Seq Scan on _hyper_1_1_chunk (never executed) +(35 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; QUERY PLAN From ad892eaa9c92f6f290b7610374350d4626bc7cc3 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:31:21 +0100 Subject: [PATCH 132/157] benchmark unsorted decompression (2024-12-12 no. 4) From c2d293ff0a5a5c304217df9fff26d6ffb9f89f89 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:19:48 +0100 Subject: [PATCH 133/157] reference --- tsl/src/chunkwise_agg.c | 4 +- .../shared/expected/ordered_append-15.out | 574 ++++++++++++------ 2 files changed, 390 insertions(+), 188 deletions(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index 5d319e5f4b2..777bcf5a7ba 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -437,7 +437,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI copy_append_like_path(root, partially_compressed_append, partially_compressed_sorted, - subpath->pathtarget)); + partial_grouping_target)); } if (can_hash) @@ -446,7 +446,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI copy_append_like_path(root, partially_compressed_append, partially_compressed_hashed, - subpath->pathtarget)); + partial_grouping_target)); } } else diff --git a/tsl/test/shared/expected/ordered_append-15.out b/tsl/test/shared/expected/ordered_append-15.out index e617dc1936a..19f37ac77f4 100644 --- a/tsl/test/shared/expected/ordered_append-15.out +++ b/tsl/test/shared/expected/ordered_append-15.out @@ -2368,18 +2368,26 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -2394,21 +2402,34 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=7196 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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 +(28 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2418,18 +2439,26 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2439,18 +2468,26 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -2465,21 +2502,34 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=7196 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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 +(28 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -3952,30 +4002,64 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -3990,30 +4074,55 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 +(49 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4023,30 +4132,64 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4056,30 +4199,64 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -4094,30 +4271,55 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 +(49 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX From c5ace455c33d75a7592339b94eff0e436411a2d9 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:21:37 +0100 Subject: [PATCH 134/157] reference REL_17_0-80-gb7467ab71c transparent_decompression-* merge_append_partially_compressed-* ordered_append-* --- .../merge_append_partially_compressed-17.out | 104 ++-- .../shared/expected/ordered_append-17.out | 574 ++++++++++++------ 2 files changed, 455 insertions(+), 223 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-17.out b/tsl/test/expected/merge_append_partially_compressed-17.out index 714bfd5706f..0806da68bd1 100644 --- a/tsl/test/expected/merge_append_partially_compressed-17.out +++ b/tsl/test/expected/merge_append_partially_compressed-17.out @@ -76,25 +76,39 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=81 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) -(19 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=84 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) + -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) +(33 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -134,28 +148,44 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',time) DESC LIMIT 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC + -> Merge Append (actual rows=1 loops=1) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Result (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Seq Scan on _hyper_1_2_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Seq Scan on _hyper_1_1_chunk (never executed) +(35 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; QUERY PLAN diff --git a/tsl/test/shared/expected/ordered_append-17.out b/tsl/test/shared/expected/ordered_append-17.out index 77f78ff6839..43dab0a2dff 100644 --- a/tsl/test/shared/expected/ordered_append-17.out +++ b/tsl/test/shared/expected/ordered_append-17.out @@ -2311,18 +2311,26 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -2337,21 +2345,34 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=7196 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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 +(28 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2361,18 +2382,26 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2382,18 +2411,26 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -2408,21 +2445,34 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=7196 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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 +(28 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -3865,30 +3915,64 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -3903,30 +3987,55 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 +(49 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -3936,30 +4045,64 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -3969,30 +4112,64 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -4007,30 +4184,55 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 +(49 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX From e5921586adbaca9d32b831bca23eda62932b4179 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:22:58 +0100 Subject: [PATCH 135/157] reference REL_14_11 transparent_decompression-* merge_append_partially_compressed-* ordered_append-* --- .../merge_append_partially_compressed-14.out | 98 ++-- .../shared/expected/ordered_append-14.out | 442 ++++++++++++------ 2 files changed, 353 insertions(+), 187 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-14.out b/tsl/test/expected/merge_append_partially_compressed-14.out index 03c903172b4..fc2e4c63e5b 100644 --- a/tsl/test/expected/merge_append_partially_compressed-14.out +++ b/tsl/test/expected/merge_append_partially_compressed-14.out @@ -76,25 +76,36 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) -(19 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) + -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) +(30 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -134,28 +145,41 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',time) DESC LIMIT 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC + -> Merge Append (actual rows=1 loops=1) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Seq Scan on _hyper_1_2_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Seq Scan on _hyper_1_1_chunk (never executed) +(32 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; QUERY PLAN diff --git a/tsl/test/shared/expected/ordered_append-14.out b/tsl/test/shared/expected/ordered_append-14.out index b7fab79f296..de47a266539 100644 --- a/tsl/test/shared/expected/ordered_append-14.out +++ b/tsl/test/shared/expected/ordered_append-14.out @@ -2344,18 +2344,22 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + 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) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(16 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -2370,21 +2374,31 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Result (actual rows=27348 loops=1) - -> Append (actual rows=27348 loops=1) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=10076 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=10076 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> 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 +(25 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2394,18 +2408,22 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + 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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(16 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2415,18 +2433,22 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + 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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(16 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -2441,21 +2463,31 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Result (actual rows=27348 loops=1) - -> Append (actual rows=27348 loops=1) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=8 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=10076 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=10076 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> 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 +(25 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -3922,30 +3954,54 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(48 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -3960,30 +4016,49 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Result (actual rows=27348 loops=1) - -> Append (actual rows=27348 loops=1) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> 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 +(43 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -3993,30 +4068,54 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(48 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4026,30 +4125,54 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(48 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -4064,30 +4187,49 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> Result (actual rows=27348 loops=1) - -> Append (actual rows=27348 loops=1) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=4 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=3598 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=4 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=6 loops=1) + Filter: (device_id = ANY ('{1,2}'::integer[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _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=5038 loops=1) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> 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 +(43 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX From 65fdd964e6d7e19173ce35d8da7dd05f11f685da Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:24:28 +0100 Subject: [PATCH 136/157] reference REL_16_4-111-g925b3aa857 transparent_decompression-* merge_append_partially_compressed-* ordered_append-* --- .../merge_append_partially_compressed-16.out | 104 ++-- .../shared/expected/ordered_append-16.out | 574 ++++++++++++------ 2 files changed, 455 insertions(+), 223 deletions(-) diff --git a/tsl/test/expected/merge_append_partially_compressed-16.out b/tsl/test/expected/merge_append_partially_compressed-16.out index 714bfd5706f..0806da68bd1 100644 --- a/tsl/test/expected/merge_append_partially_compressed-16.out +++ b/tsl/test/expected/merge_append_partially_compressed-16.out @@ -76,25 +76,39 @@ generate_series(1,3) device; QUERY PLAN ------------------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=81 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=81 loops=1) + -> Seq Scan on compress_hyper_2_4_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_1_chunk."time")) DESC, _hyper_1_1_chunk.device Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) -(19 rows) + -> Seq Scan on _hyper_1_1_chunk (actual rows=54 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=84 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=84 loops=1) + -> Seq Scan on compress_hyper_2_5_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_2_chunk."time")) DESC, _hyper_1_2_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_2_chunk (actual rows=57 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Result (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_1_3_chunk."time")) DESC, _hyper_1_3_chunk.device + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) +(33 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time desc limit 10; QUERY PLAN @@ -134,28 +148,44 @@ generate_series(1,3) device; (32 rows) :PREFIX SELECT * FROM ht_metrics_compressed ORDER BY time_bucket('2d',time) DESC LIMIT 1; - QUERY PLAN ------------------------------------------------------------------------------------------------------------ + QUERY PLAN +---------------------------------------------------------------------------------------------------------- Limit (actual rows=1 loops=1) - -> Gather Merge (actual rows=1 loops=1) - Workers Planned: 1 - Workers Launched: 1 - -> Sort (actual rows=0 loops=2) + -> Custom Scan (ChunkAppend) on ht_metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 2 days'::interval, ht_metrics_compressed."time") DESC + -> Merge Append (actual rows=1 loops=1) Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC - Sort Method: top-N heapsort - Worker 0: Sort Method: quicksort - -> Result (actual rows=162 loops=2) - -> Append (actual rows=162 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=15 loops=2) - -> Parallel Seq Scan on compress_hyper_2_6_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_3_chunk (actual rows=9 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (actual rows=42 loops=2) - -> Parallel Seq Scan on compress_hyper_2_5_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_2_chunk (actual rows=28 loops=2) - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (actual rows=40 loops=2) - -> Parallel Seq Scan on compress_hyper_2_4_chunk (actual rows=2 loops=2) - -> Parallel Seq Scan on _hyper_1_1_chunk (actual rows=27 loops=2) -(19 rows) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Result (actual rows=30 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_1_3_chunk (actual rows=30 loops=1) + -> Seq Scan on compress_hyper_2_6_chunk (actual rows=3 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_3_chunk."time")) DESC + Sort Method: top-N heapsort + -> Seq Scan on _hyper_1_3_chunk (actual rows=18 loops=1) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_1_2_chunk (never executed) + -> Seq Scan on compress_hyper_2_5_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_2_chunk."time")) DESC + -> Seq Scan on _hyper_1_2_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk (never executed) + -> Seq Scan on compress_hyper_2_4_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 2 days'::interval, _hyper_1_1_chunk."time")) DESC + -> Seq Scan on _hyper_1_1_chunk (never executed) +(35 rows) :PREFIX SELECT * FROM ht_metrics_compressed WHERE device IN (1,2,3) ORDER BY time DESC LIMIT 1; QUERY PLAN diff --git a/tsl/test/shared/expected/ordered_append-16.out b/tsl/test/shared/expected/ordered_append-16.out index e617dc1936a..19f37ac77f4 100644 --- a/tsl/test/shared/expected/ordered_append-16.out +++ b/tsl/test/shared/expected/ordered_append-16.out @@ -2368,18 +2368,26 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -2394,21 +2402,34 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=7196 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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 +(28 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2418,18 +2439,26 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -2439,18 +2468,26 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 loops=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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=25190 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=30 loops=1) -(12 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_compressed."time") + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=17990 loops=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) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(20 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -2465,21 +2502,34 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=12 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(15 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=7196 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=10076 loops=1) + -> 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 +(28 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX @@ -3952,30 +4002,64 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: time_bucket('@ 1 day'::interval, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY time_bucket, device_id -- must not use ordered append @@ -3990,30 +4074,55 @@ ORDER BY time_bucket('1d', time), LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (time_bucket('@ 1 day'::interval, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 +(49 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4023,30 +4132,64 @@ ORDER BY date_trunc('day', time) LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY date_trunc :PREFIX @@ -4056,30 +4199,64 @@ ORDER BY 1 LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) - Sort Method: top-N heapsort - -> Result (actual rows=68370 loops=1) - -> Append (actual rows=68370 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) - -> 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) - -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=15114 loops=1) - -> Seq Scan on compress_hyper_X_X_chunk (actual rows=18 loops=1) - -> 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) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Custom Scan (ChunkAppend) on metrics_space_compressed (actual rows=1 loops=1) + Order: date_trunc('day'::text, metrics_space_compressed."time") + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=10794 loops=1) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=10794 loops=1) + -> Seq Scan on compress_hyper_X_X_chunk (actual rows=12 loops=1) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + Sort Method: top-N heapsort + -> Result (actual rows=3598 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) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Merge Append (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) + -> Sort (never executed) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")) + -> Result (never executed) + -> Custom Scan (DecompressChunk) on _hyper_X_X_chunk (never executed) + -> Seq Scan on compress_hyper_X_X_chunk (never executed) +(58 rows) -- test query with ORDER BY date_trunc, device_id -- must not use ordered append @@ -4094,30 +4271,55 @@ ORDER BY 1, LIMIT 1; QUERY PLAN Limit (actual rows=1 loops=1) - -> Sort (actual rows=1 loops=1) - Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id - Sort Method: top-N heapsort - -> 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) - -> Index Scan using compress_hyper_X_X_chunk_device_id__ts_meta_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_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_min_1__ts_meta_idx on compress_hyper_X_X_chunk (actual rows=6 loops=1) - Index Cond: (device_id = ANY ('{1,2}'::integer[])) -(24 rows) + -> Result (actual rows=1 loops=1) + -> Merge Append (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=3598 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[])) + Rows Removed by Filter: 8 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 + -> Sort (actual rows=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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=1 loops=1) + Sort Key: (date_trunc('day'::text, _hyper_X_X_chunk."time")), _hyper_X_X_chunk.device_id + Sort Method: top-N heapsort + -> Result (actual rows=5038 loops=1) + -> 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 +(49 rows) -- test query with now() should result in ordered ChunkAppend :PREFIX From 1812105cde10a6da1817d380d9e15672b7642efe Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:06:29 +0100 Subject: [PATCH 137/157] more const --- .../nodes/decompress_chunk/decompress_chunk.c | 90 +++++++++++-------- 1 file changed, 54 insertions(+), 36 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index dfad5b5cb69..d27f274b84f 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -62,7 +62,8 @@ typedef enum MergeBatchResult static RangeTblEntry *decompress_chunk_make_rte(Oid compressed_relid, LOCKMODE lockmode, Query *parse); static void create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, - CompressionInfo *info, SortInfo *sort_info); + const CompressionInfo *compression_info, + const SortInfo *sort_info); static DecompressChunkPath *decompress_chunk_path_create(PlannerInfo *root, CompressionInfo *info, int parallel_workers, @@ -72,8 +73,10 @@ static void decompress_chunk_add_plannerinfo(PlannerInfo *root, CompressionInfo const Chunk *chunk, RelOptInfo *chunk_rel, bool needs_sequence_num); -static SortInfo build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, - List *pathkeys); +static SortInfo build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, + const CompressionInfo *info, List *pathkeys); + +static Bitmapset *find_const_segmentby(RelOptInfo *chunk_rel, const CompressionInfo *info); static bool is_compressed_column(CompressionInfo *info, Oid type) @@ -82,8 +85,8 @@ is_compressed_column(CompressionInfo *info, Oid type) } static EquivalenceClass * -append_ec_for_seqnum(PlannerInfo *root, CompressionInfo *info, SortInfo *sort_info, Var *var, - Oid sortop, bool nulls_first) +append_ec_for_seqnum(PlannerInfo *root, const CompressionInfo *info, const SortInfo *sort_info, + Var *var, Oid sortop, bool nulls_first) { MemoryContext oldcontext = MemoryContextSwitchTo(root->planner_cxt); @@ -151,7 +154,7 @@ append_ec_for_seqnum(PlannerInfo *root, CompressionInfo *info, SortInfo *sort_in } static EquivalenceClass * -append_ec_for_metadata_col(PlannerInfo *root, CompressionInfo *info, Var *var, PathKey *pk) +append_ec_for_metadata_col(PlannerInfo *root, const CompressionInfo *info, Var *var, PathKey *pk) { MemoryContext oldcontext = MemoryContextSwitchTo(root->planner_cxt); EquivalenceMember *em = makeNode(EquivalenceMember); @@ -186,9 +189,9 @@ append_ec_for_metadata_col(PlannerInfo *root, CompressionInfo *info, Var *var, P return ec; } -static void -build_compressed_scan_pathkeys(SortInfo *sort_info, PlannerInfo *root, List *chunk_pathkeys, - CompressionInfo *info) +static List * +build_compressed_scan_pathkeys(const SortInfo *sort_info, PlannerInfo *root, List *chunk_pathkeys, + const CompressionInfo *info) { Var *var; int varattno; @@ -353,7 +356,7 @@ build_compressed_scan_pathkeys(SortInfo *sort_info, PlannerInfo *root, List *chu } } } - sort_info->required_compressed_pathkeys = required_compressed_pathkeys; + return required_compressed_pathkeys; } DecompressChunkPath * @@ -417,6 +420,8 @@ build_compressioninfo(PlannerInfo *root, const Hypertable *ht, const Chunk *chun get_attnum(info->settings->fd.relid, COMPRESSION_COLUMN_METADATA_SEQUENCE_NUM_NAME) != InvalidAttrNumber; + info->chunk_const_segmentby = find_const_segmentby(chunk_rel, info); + return info; } @@ -844,7 +849,8 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con (compression_info->chunk_rel->reloptkind == RELOPT_BASEREL && ts_rte_is_marked_for_expansion(compression_info->chunk_rte))); - SortInfo sort_info = build_sortinfo(chunk, chunk_rel, compression_info, root->query_pathkeys); + SortInfo sort_info = + build_sortinfo(root, chunk, chunk_rel, compression_info, root->query_pathkeys); Assert(chunk->fd.compressed_chunk_id > 0); @@ -859,6 +865,16 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con chunk, chunk_rel, sort_info.needs_sequence_num); + + if (sort_info.can_pushdown_sort) + { + sort_info.required_compressed_pathkeys = + build_compressed_scan_pathkeys(&sort_info, + root, + root->query_pathkeys, + compression_info); + } + RelOptInfo *compressed_rel = compression_info->compressed_rel; compressed_rel->consider_parallel = chunk_rel->consider_parallel; @@ -1949,8 +1965,8 @@ decompress_chunk_path_create(PlannerInfo *root, CompressionInfo *info, int paral */ static void -create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, CompressionInfo *info, - SortInfo *sort_info) +create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, + const CompressionInfo *compression_info, const SortInfo *sort_info) { Path *compressed_path; @@ -2008,8 +2024,7 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, Comp */ List *orig_pathkeys = root->query_pathkeys; List *orig_eq_classes = root->eq_classes; - Bitmapset *orig_eclass_indexes = info->compressed_rel->eclass_indexes; - build_compressed_scan_pathkeys(sort_info, root, root->query_pathkeys, info); + Bitmapset *orig_eclass_indexes = compression_info->compressed_rel->eclass_indexes; root->query_pathkeys = sort_info->required_compressed_pathkeys; /* We can optimize iterating over EquivalenceClasses by reducing them to @@ -2019,24 +2034,24 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, Comp * * Clauseless joins work fine since they don't rely on eclass_indexes. */ - if (!info->chunk_rel->has_eclass_joins) + if (!compression_info->chunk_rel->has_eclass_joins) { int i = -1; List *required_eq_classes = NIL; - while ((i = bms_next_member(info->compressed_rel->eclass_indexes, i)) >= 0) + while ((i = bms_next_member(compression_info->compressed_rel->eclass_indexes, i)) >= 0) { EquivalenceClass *cur_ec = (EquivalenceClass *) list_nth(root->eq_classes, i); required_eq_classes = lappend(required_eq_classes, cur_ec); } root->eq_classes = required_eq_classes; - info->compressed_rel->eclass_indexes = NULL; + compression_info->compressed_rel->eclass_indexes = NULL; } check_index_predicates(root, compressed_rel); create_index_paths(root, compressed_rel); root->query_pathkeys = orig_pathkeys; root->eq_classes = orig_eq_classes; - info->compressed_rel->eclass_indexes = orig_eclass_indexes; + compression_info->compressed_rel->eclass_indexes = orig_eclass_indexes; } else { @@ -2114,8 +2129,8 @@ decompress_chunk_make_rte(Oid compressed_relid, LOCKMODE lockmode, Query *parse) * This will detect Var = Const and Var = Param and set the corresponding bit * in CompressionInfo->chunk_const_segmentby. */ -static void -find_const_segmentby(RelOptInfo *chunk_rel, CompressionInfo *info) +static Bitmapset * +find_const_segmentby(RelOptInfo *chunk_rel, const CompressionInfo *info) { Bitmapset *segmentby_columns = NULL; @@ -2164,7 +2179,8 @@ find_const_segmentby(RelOptInfo *chunk_rel, CompressionInfo *info) } } } - info->chunk_const_segmentby = segmentby_columns; + + return segmentby_columns; } /* @@ -2178,7 +2194,8 @@ find_const_segmentby(RelOptInfo *chunk_rel, CompressionInfo *info) * If query pathkeys is shorter than segmentby + compress_orderby pushdown can still be done */ static SortInfo -build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, List *pathkeys) +build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, + const CompressionInfo *compression_info, List *pathkeys) { int pk_index; PathKey *pk; @@ -2192,7 +2209,7 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, return sort_info; /* all segmentby columns need to be prefix of pathkeys */ - if (info->num_segmentby_columns > 0) + if (compression_info->num_segmentby_columns > 0) { Bitmapset *segmentby_columns; @@ -2200,8 +2217,7 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, * initialize segmentby with equality constraints from baserestrictinfo because * those columns dont need to be prefix of pathkeys */ - find_const_segmentby(chunk_rel, info); - segmentby_columns = bms_copy(info->chunk_const_segmentby); + segmentby_columns = bms_copy(compression_info->chunk_const_segmentby); /* * loop over pathkeys until we find one that is not a segmentby column @@ -2210,9 +2226,9 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, */ for (; lc != NULL; lc = lnext(pathkeys, lc)) { - Assert(bms_num_members(segmentby_columns) <= info->num_segmentby_columns); + Assert(bms_num_members(segmentby_columns) <= compression_info->num_segmentby_columns); pk = lfirst(lc); - expr = find_em_expr_for_rel(pk->pk_eclass, info->chunk_rel); + expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); if (expr == NULL || !IsA(expr, Var)) break; @@ -2221,8 +2237,8 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, if (var->varattno <= 0) break; - column_name = get_attname(info->chunk_rte->relid, var->varattno, false); - if (!ts_array_is_member(info->settings->fd.segmentby, column_name)) + column_name = get_attname(compression_info->chunk_rte->relid, var->varattno, false); + if (!ts_array_is_member(compression_info->settings->fd.segmentby, column_name)) break; segmentby_columns = bms_add_member(segmentby_columns, var->varattno); @@ -2232,7 +2248,8 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, * if pathkeys still has items but we didn't find all segmentby columns * we cannot push down sort */ - if (lc != NULL && bms_num_members(segmentby_columns) != info->num_segmentby_columns) + if (lc != NULL && + bms_num_members(segmentby_columns) != compression_info->num_segmentby_columns) return sort_info; } @@ -2251,7 +2268,7 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, { bool reverse = false; pk = lfirst(lc); - expr = find_em_expr_for_rel(pk->pk_eclass, info->chunk_rel); + expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); if (expr == NULL || !IsA(expr, Var)) return sort_info; @@ -2261,16 +2278,17 @@ build_sortinfo(const Chunk *chunk, RelOptInfo *chunk_rel, CompressionInfo *info, if (var->varattno <= 0) return sort_info; - column_name = get_attname(info->chunk_rte->relid, var->varattno, false); - int orderby_index = ts_array_position(info->settings->fd.orderby, column_name); + column_name = get_attname(compression_info->chunk_rte->relid, var->varattno, false); + int orderby_index = ts_array_position(compression_info->settings->fd.orderby, column_name); if (orderby_index != pk_index) return sort_info; bool orderby_desc = - ts_array_get_element_bool(info->settings->fd.orderby_desc, orderby_index); + ts_array_get_element_bool(compression_info->settings->fd.orderby_desc, orderby_index); bool orderby_nullsfirst = - ts_array_get_element_bool(info->settings->fd.orderby_nullsfirst, orderby_index); + ts_array_get_element_bool(compression_info->settings->fd.orderby_nullsfirst, + orderby_index); /* * pk_strategy is either BTLessStrategyNumber (for ASC) or From 757fb524060acf865ee6469376f3d291362774e6 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:12:26 +0100 Subject: [PATCH 138/157] remove the macro --- src/planner/planner.c | 3 +++ src/planner/planner.h | 3 --- tsl/src/nodes/decompress_chunk/decompress_chunk.c | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/planner/planner.c b/src/planner/planner.c index ae2b2752de8..9f9c9133dc7 100644 --- a/src/planner/planner.c +++ b/src/planner/planner.c @@ -277,6 +277,9 @@ ts_rte_is_hypertable(const RangeTblEntry *rte) return ht != NULL; } +#define IS_UPDL_CMD(parse) \ + ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) + typedef struct { Query *rootquery; diff --git a/src/planner/planner.h b/src/planner/planner.h index 75b0bcca83a..e82ff36ac46 100644 --- a/src/planner/planner.h +++ b/src/planner/planner.h @@ -24,9 +24,6 @@ */ #define PLANNER_LOCATION_MAGIC -29811 -#define IS_UPDL_CMD(parse) \ - ((parse)->commandType == CMD_UPDATE || (parse)->commandType == CMD_DELETE) - typedef struct Chunk Chunk; typedef struct Hypertable Hypertable; typedef struct TimescaleDBPrivate diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index d27f274b84f..5bb0c4eeabf 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -835,7 +835,10 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con * and the DML target relation are one and the same. But these kinds of queries * should be rare. */ - if (IS_UPDL_CMD(proot->parse)) + if (proot->parse->commandType == CMD_UPDATE || proot->parse->commandType == CMD_DELETE +#if PG15_GE + || proot->parse->commandType == CMD_MERGE) +#endif { add_uncompressed_part = true; } From 3e7ec2db2e8aa38cbd506632ca3377e2c02fb236 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:55:45 +0100 Subject: [PATCH 139/157] make a separate function --- .../nodes/decompress_chunk/decompress_chunk.c | 611 ++++++++++-------- .../nodes/decompress_chunk/decompress_chunk.h | 8 +- tsl/src/nodes/decompress_chunk/planner.c | 4 +- 3 files changed, 333 insertions(+), 290 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 5bb0c4eeabf..bcff6deaf7b 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -65,9 +65,8 @@ static void create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compress const CompressionInfo *compression_info, const SortInfo *sort_info); -static DecompressChunkPath *decompress_chunk_path_create(PlannerInfo *root, CompressionInfo *info, - int parallel_workers, - Path *compressed_path); +static DecompressChunkPath * +decompress_chunk_path_create(PlannerInfo *root, const CompressionInfo *info, Path *compressed_path); static void decompress_chunk_add_plannerinfo(PlannerInfo *root, CompressionInfo *info, const Chunk *chunk, RelOptInfo *chunk_rel, @@ -79,7 +78,7 @@ static SortInfo build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo static Bitmapset *find_const_segmentby(RelOptInfo *chunk_rel, const CompressionInfo *info); static bool -is_compressed_column(CompressionInfo *info, Oid type) +is_compressed_column(const CompressionInfo *info, Oid type) { return type == info->compresseddata_oid; } @@ -422,6 +421,16 @@ build_compressioninfo(PlannerInfo *root, const Hypertable *ht, const Chunk *chun info->chunk_const_segmentby = find_const_segmentby(chunk_rel, info); + /* + * If the chunk is member of hypertable expansion or a UNION, find its + * parent relation ids. We will use it later to filter out some parameterized + * paths. + */ + if (chunk_rel->reloptkind == RELOPT_OTHER_MEMBER_REL) + { + info->parent_relids = find_childrel_parents(root, chunk_rel); + } + return info; } @@ -466,7 +475,7 @@ smoothstep(double x, double start, double end) * a binary heap. */ static void -cost_batch_sorted_merge(PlannerInfo *root, CompressionInfo *compression_info, +cost_batch_sorted_merge(PlannerInfo *root, const CompressionInfo *compression_info, DecompressChunkPath *dcpath, Path *compressed_path) { Path sort_path; /* dummy for result of cost_sort */ @@ -641,7 +650,7 @@ cost_batch_sorted_merge(PlannerInfo *root, CompressionInfo *compression_info, * compatible and the optimization can be used. */ static MergeBatchResult -can_batch_sorted_merge(PlannerInfo *root, CompressionInfo *info, const Chunk *chunk) +can_batch_sorted_merge(PlannerInfo *root, const CompressionInfo *info, const Chunk *chunk) { PathKey *pk; Var *var; @@ -751,8 +760,7 @@ can_batch_sorted_merge(PlannerInfo *root, CompressionInfo *info, const Chunk *ch * To save planning time, we therefore refrain from adding them. */ static Path * -make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertable *ht, - Index ht_relid, Path *path, Path *compressed_path) +make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Path *compressed_path) { if (root->query_pathkeys == NIL) { @@ -814,6 +822,13 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertabl return sorted_path; } +static void build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, + RelOptInfo *chunk_rel, Path *compressed_path, + bool add_uncompressed_part, + List *uncompressed_table_pathlist, + const SortInfo *sort_info, + const CompressionInfo *compression_info); + void ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertable *ht, const Chunk *chunk) @@ -857,8 +872,8 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con Assert(chunk->fd.compressed_chunk_id > 0); - List *initial_pathlist = chunk_rel->pathlist; - List *initial_partial_pathlist = chunk_rel->partial_pathlist; + List *uncompressed_table_pathlist = chunk_rel->pathlist; + List *uncompressed_table_parallel_pathlist = chunk_rel->partial_pathlist; chunk_rel->pathlist = NIL; chunk_rel->partial_pathlist = NIL; @@ -905,270 +920,19 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con create_compressed_scan_paths(root, compressed_rel, compression_info, &sort_info); - /* compute parent relids of the chunk and use it to filter paths*/ - Relids parent_relids = NULL; - if (!compression_info->single_chunk) - parent_relids = find_childrel_parents(root, chunk_rel); - /* create non-parallel paths */ ListCell *lc; foreach (lc, compressed_rel->pathlist) { Path *compressed_path = lfirst(lc); - - /* - * We skip any BitmapScan parameterized paths here as supporting - * those would require fixing up the internal scan. Since we - * currently do not do this BitmapScans would be generated - * when we have a parameterized path on a compressed column - * that would have invalid references due to our - * EquivalenceClasses. - */ - if (IsA(compressed_path, BitmapHeapPath) && compressed_path->param_info) - continue; - - /* - * Filter out all paths that try to JOIN the compressed chunk on the - * hypertable or the uncompressed chunk - * Ideally, we wouldn't create these paths in the first place. - * However, create_join_clause code is called by PG while generating paths for the - * compressed_rel via generate_implied_equalities_for_column. - * create_join_clause ends up creating rinfo's between compressed_rel and ht because - * PG does not know that compressed_rel is related to ht in anyway. - * The parent-child relationship between chunk_rel and ht is known - * to PG and so it does not try to create meaningless rinfos for that case. - */ - if (compressed_path->param_info != NULL) - { - if (bms_is_member(chunk_rel->relid, compressed_path->param_info->ppi_req_outer)) - continue; - /* check if this is path made with references between - * compressed_rel + hypertable or a nesting subquery. - * The latter can happen in the case of UNION queries. see github 2917. This - * happens since PG is not aware that the nesting - * subquery that references the hypertable is a parent of compressed_rel as well. - */ - if (bms_overlap(parent_relids, compressed_path->param_info->ppi_req_outer)) - continue; - - ListCell *lc_ri; - bool references_compressed = false; - /* - * Check if this path is parameterized on a compressed - * column. Ideally those paths wouldn't be generated - * in the first place but since we create compressed - * EquivalenceMembers for all EquivalenceClasses these - * Paths can happen and will fail at execution since - * the left and right side of the expression are not - * compatible. Therefore we skip any Path that is - * parameterized on a compressed column here. - */ - foreach (lc_ri, compressed_path->param_info->ppi_clauses) - { - RestrictInfo *ri = lfirst_node(RestrictInfo, lc_ri); - - if (ri->right_em && IsA(ri->right_em->em_expr, Var) && - (Index) castNode(Var, ri->right_em->em_expr)->varno == - compression_info->compressed_rel->relid) - { - Var *var = castNode(Var, ri->right_em->em_expr); - if (is_compressed_column(compression_info, var->vartype)) - { - references_compressed = true; - break; - } - } - if (ri->left_em && IsA(ri->left_em->em_expr, Var) && - (Index) castNode(Var, ri->left_em->em_expr)->varno == - compression_info->compressed_rel->relid) - { - Var *var = castNode(Var, ri->left_em->em_expr); - if (is_compressed_column(compression_info, var->vartype)) - { - references_compressed = true; - break; - } - } - } - if (references_compressed) - continue; - } - - Path *chunk_path_no_sort = - (Path *) decompress_chunk_path_create(root, compression_info, 0, compressed_path); - List *decompressed_paths = list_make1(chunk_path_no_sort); - - /* - * If we can push down the sort below the DecompressChunk node, we set the pathkeys of - * the decompress node to the query pathkeys, while remembering the compressed_pathkeys - * corresponding to those query_pathkeys. We will determine whether to put a sort - * between the decompression node and the scan during plan creation. - */ - if (sort_info.can_pushdown_sort) - { - if (pathkeys_contained_in(sort_info.required_compressed_pathkeys, - compressed_path->pathkeys)) - { - /* - * The compressed path already has the required ordering. Modify - * in place the no-sorting path we just created above. - */ - DecompressChunkPath *path = (DecompressChunkPath *) chunk_path_no_sort; - path->reverse = sort_info.reverse; - path->needs_sequence_num = sort_info.needs_sequence_num; - path->required_compressed_pathkeys = sort_info.required_compressed_pathkeys; - path->custom_path.path.pathkeys = root->query_pathkeys; - } - else - { - /* - * We must sort the underlying compressed path to get the - * required ordering. Make a copy of no-sorting path and modify - * it accordingly - */ - DecompressChunkPath *path_copy = - copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); - path_copy->reverse = sort_info.reverse; - path_copy->needs_sequence_num = sort_info.needs_sequence_num; - path_copy->required_compressed_pathkeys = sort_info.required_compressed_pathkeys; - path_copy->custom_path.path.pathkeys = root->query_pathkeys; - - /* - * Add costing for a sort. The standard Postgres pattern is to add the cost during - * path creation, but not add the sort path itself, that's done during plan - * creation. Examples of this in: create_merge_append_path & - * create_merge_append_plan - */ - Path sort_path; /* dummy for result of cost_sort */ - - cost_sort(&sort_path, - root, - sort_info.required_compressed_pathkeys, - compressed_path->total_cost, - compressed_path->rows, - compressed_path->pathtarget->width, - 0.0, - work_mem, - -1); - - cost_decompress_chunk(root, &path_copy->custom_path.path, &sort_path); - - decompressed_paths = lappend(decompressed_paths, path_copy); - } - } - else if (ts_guc_enable_decompression_sorted_merge) - { - /* - * Create a path for the batch sorted merge optimization. This - * optimization performs a sorted merge of the involved batches by - * using a binary heap and preserving the compression order. This - * optimization is only taken into consideration if we can't push - * down the sort to the compressed chunk. If we can push down the - * sort, the batches can be directly consumed in this order and we - * don't need to use this optimization. - */ - MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); - if (merge_result != MERGE_NOT_POSSIBLE) - { - DecompressChunkPath *path_copy = - copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); - - path_copy->reverse = (merge_result != SCAN_FORWARD); - path_copy->batch_sorted_merge = true; - - /* The segment by optimization is only enabled if it can deliver the tuples in the - * same order as the query requested it. So, we can just copy the pathkeys of the - * query here. - */ - path_copy->custom_path.path.pathkeys = root->query_pathkeys; - cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); - - decompressed_paths = lappend(decompressed_paths, path_copy); - } - } - - /* - * Add sorted version of the decompress path, if we couldn't push down - * the sort. - */ - if (!sort_info.can_pushdown_sort) - { - Path *sort_above_chunk = make_chunk_sorted_path(root, - chunk_rel, - ht, - ht_relid, - chunk_path_no_sort, - compressed_path); - if (sort_above_chunk != NULL) - { - decompressed_paths = lappend(decompressed_paths, sort_above_chunk); - } - } - - /* - * If this is a partially compressed chunk we have to combine data - * from compressed and uncompressed chunk. - */ - if (add_uncompressed_part) - { - Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); - Path *uncompressed_path = - get_cheapest_path_for_pathkeys(initial_pathlist, NIL, req_outer, TOTAL_COST, false); - - /* - * All children of an append path are required to have the same parameterization - * so we reparameterize here when we couldn't get a path with the parameterization - * we need. Reparameterization should always succeed here since uncompressed_path - * should always be a scan. - */ - if (!bms_equal(req_outer, PATH_REQ_OUTER(uncompressed_path))) - { - uncompressed_path = reparameterize_path(root, uncompressed_path, req_outer, 1.0); - if (!uncompressed_path) - continue; - } - - ListCell *lc; - foreach (lc, decompressed_paths) - { - /* - * Combine decompressed path with uncompressed part of the chunk, - * using either MergeAppend or plain Append, depending on - * whether it has sorting. - */ - Path *path = lfirst(lc); - if (path->pathkeys == NIL) - { - path = (Path *) create_append_path(root, - chunk_rel, - list_make2(path, uncompressed_path), - /* partial_subpaths = */ NIL, - /* pathkeys = */ NIL, - req_outer, - /* parallel_workers = */ 0, - /* parallel_aware = */ false, - path->rows + uncompressed_path->rows); - } - else - { - path = (Path *) create_merge_append_path(root, - chunk_rel, - list_make2(path, uncompressed_path), - path->pathkeys, - req_outer); - } - - lfirst(lc) = path; - } - } - - /* - * Add the paths to the chunk relation. - */ - foreach (lc, decompressed_paths) - { - add_path(chunk_rel, lfirst(lc)); - } + build_on_single_compressed_path(root, + chunk, + chunk_rel, + compressed_path, + add_uncompressed_part, + uncompressed_table_pathlist, + &sort_info, + compression_info); } /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed @@ -1192,10 +956,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con * If this is a partially compressed chunk we have to combine data * from compressed and uncompressed chunk. */ - path = (Path *) decompress_chunk_path_create(root, - compression_info, - compressed_path->parallel_workers, - compressed_path); + path = (Path *) decompress_chunk_path_create(root, compression_info, compressed_path); if (add_uncompressed_part) { @@ -1203,16 +964,19 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con Path *uncompressed_path = NULL; bool uncompressed_path_is_partial = true; - if (initial_partial_pathlist) - uncompressed_path = get_cheapest_path_for_pathkeys(initial_partial_pathlist, - NIL, - req_outer, - TOTAL_COST, - true); + if (uncompressed_table_parallel_pathlist) + { + uncompressed_path = + get_cheapest_path_for_pathkeys(uncompressed_table_parallel_pathlist, + NIL, + req_outer, + TOTAL_COST, + true); + } if (!uncompressed_path) { - uncompressed_path = get_cheapest_path_for_pathkeys(initial_pathlist, + uncompressed_path = get_cheapest_path_for_pathkeys(uncompressed_table_pathlist, NIL, req_outer, TOTAL_COST, @@ -1271,6 +1035,286 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con Ensure(chunk_rel->pathlist, "could not create decompression path"); } +/* + * Add various decompression paths that are possible based on the given + * compressed path. + */ +static void +build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, + Path *compressed_path, bool add_uncompressed_part, + List *uncompressed_table_pathlist, const SortInfo *sort_info, + const CompressionInfo *compression_info) +{ + ListCell *lc; + + /* + * We skip any BitmapScan parameterized paths here as supporting + * those would require fixing up the internal scan. Since we + * currently do not do this BitmapScans would be generated + * when we have a parameterized path on a compressed column + * that would have invalid references due to our + * EquivalenceClasses. + */ + if (IsA(compressed_path, BitmapHeapPath) && compressed_path->param_info) + return; + + /* + * Filter out all paths that try to JOIN the compressed chunk on the + * hypertable or the uncompressed chunk + * Ideally, we wouldn't create these paths in the first place. + * However, create_join_clause code is called by PG while generating paths for the + * compressed_rel via generate_implied_equalities_for_column. + * create_join_clause ends up creating rinfo's between compressed_rel and ht because + * PG does not know that compressed_rel is related to ht in anyway. + * The parent-child relationship between chunk_rel and ht is known + * to PG and so it does not try to create meaningless rinfos for that case. + */ + if (compressed_path->param_info != NULL) + { + if (bms_is_member(chunk_rel->relid, compressed_path->param_info->ppi_req_outer)) + return; + /* check if this is path made with references between + * compressed_rel + hypertable or a nesting subquery. + * The latter can happen in the case of UNION queries. see github 2917. This + * happens since PG is not aware that the nesting + * subquery that references the hypertable is a parent of compressed_rel as well. + */ + if (bms_overlap(compression_info->parent_relids, + compressed_path->param_info->ppi_req_outer)) + { + return; + } + + ListCell *lc_ri; + bool references_compressed = false; + /* + * Check if this path is parameterized on a compressed + * column. Ideally those paths wouldn't be generated + * in the first place but since we create compressed + * EquivalenceMembers for all EquivalenceClasses these + * Paths can happen and will fail at execution since + * the left and right side of the expression are not + * compatible. Therefore we skip any Path that is + * parameterized on a compressed column here. + */ + foreach (lc_ri, compressed_path->param_info->ppi_clauses) + { + RestrictInfo *ri = lfirst_node(RestrictInfo, lc_ri); + + if (ri->right_em && IsA(ri->right_em->em_expr, Var) && + (Index) castNode(Var, ri->right_em->em_expr)->varno == + compression_info->compressed_rel->relid) + { + Var *var = castNode(Var, ri->right_em->em_expr); + if (is_compressed_column(compression_info, var->vartype)) + { + references_compressed = true; + break; + } + } + if (ri->left_em && IsA(ri->left_em->em_expr, Var) && + (Index) castNode(Var, ri->left_em->em_expr)->varno == + compression_info->compressed_rel->relid) + { + Var *var = castNode(Var, ri->left_em->em_expr); + if (is_compressed_column(compression_info, var->vartype)) + { + references_compressed = true; + break; + } + } + } + if (references_compressed) + return; + } + + Path *chunk_path_no_sort = + (Path *) decompress_chunk_path_create(root, compression_info, compressed_path); + List *decompressed_paths = list_make1(chunk_path_no_sort); + + /* + * If we can push down the sort below the DecompressChunk node, we set the pathkeys of + * the decompress node to the query pathkeys, while remembering the compressed_pathkeys + * corresponding to those query_pathkeys. We will determine whether to put a sort + * between the decompression node and the scan during plan creation. + */ + if (sort_info->can_pushdown_sort) + { + if (pathkeys_contained_in(sort_info->required_compressed_pathkeys, + compressed_path->pathkeys)) + { + /* + * The compressed path already has the required ordering. Modify + * in place the no-sorting path we just created above. + */ + DecompressChunkPath *path = (DecompressChunkPath *) chunk_path_no_sort; + path->reverse = sort_info->reverse; + path->needs_sequence_num = sort_info->needs_sequence_num; + path->required_compressed_pathkeys = sort_info->required_compressed_pathkeys; + path->custom_path.path.pathkeys = root->query_pathkeys; + } + else + { + /* + * We must sort the underlying compressed path to get the + * required ordering. Make a copy of no-sorting path and modify + * it accordingly + */ + DecompressChunkPath *path_copy = + copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); + path_copy->reverse = sort_info->reverse; + path_copy->needs_sequence_num = sort_info->needs_sequence_num; + path_copy->required_compressed_pathkeys = sort_info->required_compressed_pathkeys; + path_copy->custom_path.path.pathkeys = root->query_pathkeys; + + /* + * Add costing for a sort. The standard Postgres pattern is to add the cost during + * path creation, but not add the sort path itself, that's done during plan + * creation. Examples of this in: create_merge_append_path & + * create_merge_append_plan + */ + Path sort_path; /* dummy for result of cost_sort */ + + cost_sort(&sort_path, + root, + sort_info->required_compressed_pathkeys, + compressed_path->total_cost, + compressed_path->rows, + compressed_path->pathtarget->width, + 0.0, + work_mem, + -1); + + cost_decompress_chunk(root, &path_copy->custom_path.path, &sort_path); + + decompressed_paths = lappend(decompressed_paths, path_copy); + } + } + else if (ts_guc_enable_decompression_sorted_merge) + { + /* + * Create a path for the batch sorted merge optimization. This + * optimization performs a sorted merge of the involved batches by + * using a binary heap and preserving the compression order. This + * optimization is only taken into consideration if we can't push + * down the sort to the compressed chunk. If we can push down the + * sort, the batches can be directly consumed in this order and we + * don't need to use this optimization. + */ + MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); + if (merge_result != MERGE_NOT_POSSIBLE) + { + DecompressChunkPath *path_copy = + copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); + + path_copy->reverse = (merge_result != SCAN_FORWARD); + path_copy->batch_sorted_merge = true; + path_copy->custom_path.path.parallel_workers = 0; + + /* The segment by optimization is only enabled if it can deliver the tuples in the + * same order as the query requested it. So, we can just copy the pathkeys of the + * query here. + */ + path_copy->custom_path.path.pathkeys = root->query_pathkeys; + cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); + + decompressed_paths = lappend(decompressed_paths, path_copy); + } + } + + /* + * Add sorted version of the decompress path, if we couldn't push down + * the sort. + */ + if (!sort_info->can_pushdown_sort) + { + Path *sort_above_chunk = + make_chunk_sorted_path(root, chunk_rel, chunk_path_no_sort, compressed_path); + if (sort_above_chunk != NULL) + { + decompressed_paths = lappend(decompressed_paths, sort_above_chunk); + } + } + + /* + * If this is a partially compressed chunk we have to combine data + * from compressed and uncompressed chunk. + */ + if (add_uncompressed_part) + { + Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); + Path *uncompressed_path = get_cheapest_path_for_pathkeys(uncompressed_table_pathlist, + NIL, + req_outer, + TOTAL_COST, + false); + + /* + * All children of an append path are required to have the same parameterization + * so we reparameterize here when we couldn't get a path with the parameterization + * we need. Reparameterization should always succeed here since uncompressed_path + * should always be a scan. + */ + if (!bms_equal(req_outer, PATH_REQ_OUTER(uncompressed_path))) + { + uncompressed_path = reparameterize_path(root, uncompressed_path, req_outer, 1.0); + if (!uncompressed_path) + return; + } + + ListCell *lc; + foreach (lc, decompressed_paths) + { + /* + * Combine decompressed path with uncompressed part of the chunk, + * using either MergeAppend or plain Append, depending on + * whether it has sorting. + */ + Path *path = lfirst(lc); + if (path->pathkeys == NIL) + { + const int workers = + Max(path->parallel_workers, uncompressed_path->parallel_workers); + path = (Path *) create_append_path(root, + chunk_rel, + list_make2(path, uncompressed_path), + /* partial_subpaths = */ NIL, + /* pathkeys = */ NIL, + req_outer, + workers, + workers > 0, + path->rows + uncompressed_path->rows); + } + else + { + path = (Path *) create_merge_append_path(root, + chunk_rel, + list_make2(path, uncompressed_path), + path->pathkeys, + req_outer); + } + + lfirst(lc) = path; + } + } + + /* + * Add the paths to the chunk relation. + */ + foreach (lc, decompressed_paths) + { + Path *path = lfirst(lc); + if (path->parallel_workers > 0) + { + add_partial_path(chunk_rel, path); + } + else + { + add_path(chunk_rel, path); + } + } +} + /* * Add a var for a particular column to the reltarget. attrs_used is a bitmap * of which columns we already have in reltarget. We do not add the columns that @@ -1911,8 +1955,7 @@ decompress_chunk_add_plannerinfo(PlannerInfo *root, CompressionInfo *info, const } static DecompressChunkPath * -decompress_chunk_path_create(PlannerInfo *root, CompressionInfo *info, int parallel_workers, - Path *compressed_path) +decompress_chunk_path_create(PlannerInfo *root, const CompressionInfo *info, Path *compressed_path) { DecompressChunkPath *path; @@ -1951,8 +1994,8 @@ decompress_chunk_path_create(PlannerInfo *root, CompressionInfo *info, int paral * in a parallel plan we only set parallel_safe to true * when parallel_workers is greater than 0 which is only * the case when creating partial paths. */ - path->custom_path.path.parallel_safe = parallel_workers > 0; - path->custom_path.path.parallel_workers = parallel_workers; + path->custom_path.path.parallel_safe = compressed_path->parallel_workers > 0; + path->custom_path.path.parallel_workers = compressed_path->parallel_workers; path->custom_path.path.parallel_aware = false; path->custom_path.custom_paths = list_make1(compressed_path); diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.h b/tsl/src/nodes/decompress_chunk/decompress_chunk.h index d224c2a3394..d93d28343eb 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.h +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.h @@ -42,15 +42,15 @@ typedef struct CompressionInfo /* compressed chunk attribute numbers for columns that are compressed */ Bitmapset *compressed_attnos_in_compressed_chunk; - bool single_chunk; /* query on explicit chunk */ - bool has_seq_num; /* legacy sequence number support */ - + bool single_chunk; /* query on explicit chunk */ + bool has_seq_num; /* legacy sequence number support */ + Relids parent_relids; /* relids of the parent hypertable and UNION */ } CompressionInfo; typedef struct DecompressChunkPath { CustomPath custom_path; - CompressionInfo *info; + const CompressionInfo *info; List *required_compressed_pathkeys; bool needs_sequence_num; diff --git a/tsl/src/nodes/decompress_chunk/planner.c b/tsl/src/nodes/decompress_chunk/planner.c index 785b846e583..e9675282821 100644 --- a/tsl/src/nodes/decompress_chunk/planner.c +++ b/tsl/src/nodes/decompress_chunk/planner.c @@ -252,7 +252,7 @@ static void build_decompression_map(DecompressionMapContext *context, List *compressed_scan_tlist) { DecompressChunkPath *path = context->decompress_path; - CompressionInfo *info = path->info; + const CompressionInfo *info = path->info; /* * Track which normal and metadata columns we were able to find in the * targetlist. @@ -522,7 +522,7 @@ build_decompression_map(DecompressionMapContext *context, List *compressed_scan_ * uncompressed one. Based on replace_nestloop_params */ static Node * -replace_compressed_vars(Node *node, CompressionInfo *info) +replace_compressed_vars(Node *node, const CompressionInfo *info) { if (node == NULL) return NULL; From 8b0a0935d19c1b97580f2539a6d7ceac2c5ff2b3 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 15:57:25 +0100 Subject: [PATCH 140/157] brrace --- tsl/src/nodes/decompress_chunk/decompress_chunk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index bcff6deaf7b..a37ad7149b9 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -852,8 +852,9 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con */ if (proot->parse->commandType == CMD_UPDATE || proot->parse->commandType == CMD_DELETE #if PG15_GE - || proot->parse->commandType == CMD_MERGE) + || proot->parse->commandType == CMD_MERGE #endif + ) { add_uncompressed_part = true; } From 8010a6b7132869b7f69d9f985559c9cefab67b6b Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:22:10 +0100 Subject: [PATCH 141/157] unify parallel path handling --- .../nodes/decompress_chunk/decompress_chunk.c | 371 +++++++----------- 1 file changed, 136 insertions(+), 235 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index a37ad7149b9..78a60394a27 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -77,12 +77,6 @@ static SortInfo build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo static Bitmapset *find_const_segmentby(RelOptInfo *chunk_rel, const CompressionInfo *info); -static bool -is_compressed_column(const CompressionInfo *info, Oid type) -{ - return type == info->compresseddata_oid; -} - static EquivalenceClass * append_ec_for_seqnum(PlannerInfo *root, const CompressionInfo *info, const SortInfo *sort_info, Var *var, Oid sortop, bool nulls_first) @@ -822,12 +816,12 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Pat return sorted_path; } -static void build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, - RelOptInfo *chunk_rel, Path *compressed_path, - bool add_uncompressed_part, - List *uncompressed_table_pathlist, - const SortInfo *sort_info, - const CompressionInfo *compression_info); +static List *build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, + RelOptInfo *chunk_rel, Path *compressed_path, + bool add_uncompressed_part, + List *uncompressed_table_pathlist, + const SortInfo *sort_info, + const CompressionInfo *compression_info); void ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, const Hypertable *ht, @@ -922,112 +916,59 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con create_compressed_scan_paths(root, compressed_rel, compression_info, &sort_info); /* create non-parallel paths */ - ListCell *lc; - foreach (lc, compressed_rel->pathlist) + ListCell *compressed_cell; + foreach (compressed_cell, compressed_rel->pathlist) { - Path *compressed_path = lfirst(lc); - build_on_single_compressed_path(root, - chunk, - chunk_rel, - compressed_path, - add_uncompressed_part, - uncompressed_table_pathlist, - &sort_info, - compression_info); + Path *compressed_path = lfirst(compressed_cell); + List *decompressed_paths = build_on_single_compressed_path(root, + chunk, + chunk_rel, + compressed_path, + add_uncompressed_part, + uncompressed_table_pathlist, + &sort_info, + compression_info); + /* + * Add the paths to the chunk relation. + */ + ListCell *decompressed_cell; + foreach (decompressed_cell, decompressed_paths) + { + Path *path = lfirst(decompressed_cell); + add_path(chunk_rel, path); + } } - /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed - * if it's planned */ - compressed_rel->pathlist = NIL; - /* create parallel paths */ - if (compressed_rel->consider_parallel) + List *uncompressed_paths_with_parallel = + list_concat(uncompressed_table_parallel_pathlist, uncompressed_table_pathlist); + foreach (compressed_cell, compressed_rel->partial_pathlist) { - foreach (lc, compressed_rel->partial_pathlist) + Path *compressed_path = lfirst(compressed_cell); + List *decompressed_paths = build_on_single_compressed_path(root, + chunk, + chunk_rel, + compressed_path, + add_uncompressed_part, + uncompressed_paths_with_parallel, + &sort_info, + compression_info); + /* + * Add the paths to the chunk relation. + */ + ListCell *decompressed_cell; + foreach (decompressed_cell, decompressed_paths) { - Path *compressed_path = lfirst(lc); - Path *path; - if (compressed_path->param_info != NULL && - (bms_is_member(chunk_rel->relid, compressed_path->param_info->ppi_req_outer) || - (!compression_info->single_chunk && - bms_is_member(ht_relid, compressed_path->param_info->ppi_req_outer)))) - continue; - - /* - * If this is a partially compressed chunk we have to combine data - * from compressed and uncompressed chunk. - */ - path = (Path *) decompress_chunk_path_create(root, compression_info, compressed_path); - - if (add_uncompressed_part) - { - Bitmapset *req_outer = PATH_REQ_OUTER(path); - Path *uncompressed_path = NULL; - bool uncompressed_path_is_partial = true; - - if (uncompressed_table_parallel_pathlist) - { - uncompressed_path = - get_cheapest_path_for_pathkeys(uncompressed_table_parallel_pathlist, - NIL, - req_outer, - TOTAL_COST, - true); - } - - if (!uncompressed_path) - { - uncompressed_path = get_cheapest_path_for_pathkeys(uncompressed_table_pathlist, - NIL, - req_outer, - TOTAL_COST, - true); - uncompressed_path_is_partial = false; - } - - /* - * All children of an append path are required to have the same parameterization - * so we reparameterize here when we couldn't get a path with the parameterization - * we need. Reparameterization should always succeed here since uncompressed_path - * should always be a scan. - */ - if (!bms_equal(req_outer, PATH_REQ_OUTER(uncompressed_path))) - { - uncompressed_path = - reparameterize_path(root, uncompressed_path, req_outer, 1.0); - if (!uncompressed_path) - continue; - } - - /* uncompressed_path can be a partial or a non-partial path. Categorize the path - * and add it to the proper list of the append path. */ - List *partial_path_list = list_make1(path); - List *path_list = NIL; - - if (uncompressed_path_is_partial) - partial_path_list = lappend(partial_path_list, uncompressed_path); - else - path_list = list_make1(uncompressed_path); - - /* Use a parallel aware append to handle non-partial paths properly */ - path = (Path *) create_append_path(root, - chunk_rel, - path_list, - partial_path_list, - NIL /* pathkeys */, - req_outer, - Max(path->parallel_workers, - uncompressed_path->parallel_workers), - true, /* parallel aware */ - path->rows + uncompressed_path->rows); - } - + Path *path = lfirst(decompressed_cell); add_partial_path(chunk_rel, path); } - /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't - * be freed if it's planned */ - compressed_rel->partial_pathlist = NIL; } + + /* the chunk_rel now owns the paths, remove them from the compressed_rel so they can't be freed + * if it's planned */ + compressed_rel->pathlist = NIL; + compressed_rel->partial_pathlist = NIL; + /* Remove the compressed_rel from the simple_rel_array to prevent it from * being referenced again. */ root->simple_rel_array[compressed_rel->relid] = NULL; @@ -1040,14 +981,12 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con * Add various decompression paths that are possible based on the given * compressed path. */ -static void +static List * build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, Path *compressed_path, bool add_uncompressed_part, List *uncompressed_table_pathlist, const SortInfo *sort_info, const CompressionInfo *compression_info) { - ListCell *lc; - /* * We skip any BitmapScan parameterized paths here as supporting * those would require fixing up the internal scan. Since we @@ -1057,7 +996,7 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * EquivalenceClasses. */ if (IsA(compressed_path, BitmapHeapPath) && compressed_path->param_info) - return; + return NIL; /* * Filter out all paths that try to JOIN the compressed chunk on the @@ -1073,7 +1012,8 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf if (compressed_path->param_info != NULL) { if (bms_is_member(chunk_rel->relid, compressed_path->param_info->ppi_req_outer)) - return; + return NIL; + /* check if this is path made with references between * compressed_rel + hypertable or a nesting subquery. * The latter can happen in the case of UNION queries. see github 2917. This @@ -1083,50 +1023,8 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf if (bms_overlap(compression_info->parent_relids, compressed_path->param_info->ppi_req_outer)) { - return; + return NIL; } - - ListCell *lc_ri; - bool references_compressed = false; - /* - * Check if this path is parameterized on a compressed - * column. Ideally those paths wouldn't be generated - * in the first place but since we create compressed - * EquivalenceMembers for all EquivalenceClasses these - * Paths can happen and will fail at execution since - * the left and right side of the expression are not - * compatible. Therefore we skip any Path that is - * parameterized on a compressed column here. - */ - foreach (lc_ri, compressed_path->param_info->ppi_clauses) - { - RestrictInfo *ri = lfirst_node(RestrictInfo, lc_ri); - - if (ri->right_em && IsA(ri->right_em->em_expr, Var) && - (Index) castNode(Var, ri->right_em->em_expr)->varno == - compression_info->compressed_rel->relid) - { - Var *var = castNode(Var, ri->right_em->em_expr); - if (is_compressed_column(compression_info, var->vartype)) - { - references_compressed = true; - break; - } - } - if (ri->left_em && IsA(ri->left_em->em_expr, Var) && - (Index) castNode(Var, ri->left_em->em_expr)->varno == - compression_info->compressed_rel->relid) - { - Var *var = castNode(Var, ri->left_em->em_expr); - if (is_compressed_column(compression_info, var->vartype)) - { - references_compressed = true; - break; - } - } - } - if (references_compressed) - return; } Path *chunk_path_no_sort = @@ -1191,17 +1089,17 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf decompressed_paths = lappend(decompressed_paths, path_copy); } } - else if (ts_guc_enable_decompression_sorted_merge) + + /* + * Create a path for the batch sorted merge optimization. This optimization + * performs a sorted merge of the involved batches by using a binary heap + * and preserving the compression order. This optimization is only + * considered if we can't push down the sort to the compressed chunk. If we + * can push down the sort, the batches can be directly consumed in this + * order and we don't need to use this optimization. + */ + if (!sort_info->can_pushdown_sort && ts_guc_enable_decompression_sorted_merge) { - /* - * Create a path for the batch sorted merge optimization. This - * optimization performs a sorted merge of the involved batches by - * using a binary heap and preserving the compression order. This - * optimization is only taken into consideration if we can't push - * down the sort to the compressed chunk. If we can push down the - * sort, the batches can be directly consumed in this order and we - * don't need to use this optimization. - */ MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); if (merge_result != MERGE_NOT_POSSIBLE) { @@ -1210,7 +1108,6 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf path_copy->reverse = (merge_result != SCAN_FORWARD); path_copy->batch_sorted_merge = true; - path_copy->custom_path.path.parallel_workers = 0; /* The segment by optimization is only enabled if it can deliver the tuples in the * same order as the query requested it. So, we can just copy the pathkeys of the @@ -1224,10 +1121,13 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf } /* - * Add sorted version of the decompress path, if we couldn't push down - * the sort. + * Also try explicit sort after decompression, if we couldn't push down the + * sort. Don't do this for parallel plans, because in this case it is + * typically done with Sort under Gather node. This splits the Sort in + * per-worker buckets, so splitting the buckets further per-chunk is less + * important. */ - if (!sort_info->can_pushdown_sort) + if (!sort_info->can_pushdown_sort && chunk_path_no_sort->parallel_workers == 0) { Path *sort_above_chunk = make_chunk_sorted_path(root, chunk_rel, chunk_path_no_sort, compressed_path); @@ -1237,83 +1137,83 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf } } - /* - * If this is a partially compressed chunk we have to combine data - * from compressed and uncompressed chunk. - */ - if (add_uncompressed_part) + if (!add_uncompressed_part) { - Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); - Path *uncompressed_path = get_cheapest_path_for_pathkeys(uncompressed_table_pathlist, - NIL, - req_outer, - TOTAL_COST, - false); - /* - * All children of an append path are required to have the same parameterization - * so we reparameterize here when we couldn't get a path with the parameterization - * we need. Reparameterization should always succeed here since uncompressed_path - * should always be a scan. + * If the chunk has only the compressed part, we're done. */ - if (!bms_equal(req_outer, PATH_REQ_OUTER(uncompressed_path))) - { - uncompressed_path = reparameterize_path(root, uncompressed_path, req_outer, 1.0); - if (!uncompressed_path) - return; - } - - ListCell *lc; - foreach (lc, decompressed_paths) - { - /* - * Combine decompressed path with uncompressed part of the chunk, - * using either MergeAppend or plain Append, depending on - * whether it has sorting. - */ - Path *path = lfirst(lc); - if (path->pathkeys == NIL) - { - const int workers = - Max(path->parallel_workers, uncompressed_path->parallel_workers); - path = (Path *) create_append_path(root, - chunk_rel, - list_make2(path, uncompressed_path), - /* partial_subpaths = */ NIL, - /* pathkeys = */ NIL, - req_outer, - workers, - workers > 0, - path->rows + uncompressed_path->rows); - } - else - { - path = (Path *) create_merge_append_path(root, - chunk_rel, - list_make2(path, uncompressed_path), - path->pathkeys, - req_outer); - } - - lfirst(lc) = path; - } + return decompressed_paths; } /* - * Add the paths to the chunk relation. + * This is a partially compressed chunk, we have to combine data from + * compressed and uncompressed chunk. + */ + List *combined_paths = NIL; + Bitmapset *req_outer = PATH_REQ_OUTER(chunk_path_no_sort); + Path *uncompressed_path = get_cheapest_path_for_pathkeys(uncompressed_table_pathlist, + NIL, + req_outer, + TOTAL_COST, + false); + + /* + * All children of an append path are required to have the same parameterization + * so we reparameterize here when we couldn't get a path with the parameterization + * we need. Reparameterization should always succeed here since uncompressed_path + * should always be a scan. */ + if (!bms_equal(req_outer, PATH_REQ_OUTER(uncompressed_path))) + { + uncompressed_path = reparameterize_path(root, uncompressed_path, req_outer, 1.0); + if (!uncompressed_path) + return NIL; + } + + ListCell *lc; foreach (lc, decompressed_paths) { - Path *path = lfirst(lc); - if (path->parallel_workers > 0) + /* + * Combine decompressed path with uncompressed part of the chunk, + * using either MergeAppend or plain Append, depending on + * whether it has sorting. + */ + Path *combined_path = NULL; + Path *decompressed_path = lfirst(lc); + const int workers = + Max(decompressed_path->parallel_workers, uncompressed_path->parallel_workers); + if (decompressed_path->pathkeys == NIL) { - add_partial_path(chunk_rel, path); + combined_path = + (Path *) create_append_path(root, + chunk_rel, + list_make2(decompressed_path, uncompressed_path), + /* partial_subpaths = */ NIL, + /* pathkeys = */ NIL, + req_outer, + workers, + ///* parallel_aware = */ false, + workers > 0, + decompressed_path->rows + uncompressed_path->rows); + } + else if (workers == 0) + { + combined_path = + (Path *) create_merge_append_path(root, + chunk_rel, + list_make2(decompressed_path, uncompressed_path), + decompressed_path->pathkeys, + req_outer); } else { - add_path(chunk_rel, path); + continue; } + + combined_paths = lappend(combined_paths, combined_path); } + + return combined_paths; } /* @@ -1995,9 +1895,10 @@ decompress_chunk_path_create(PlannerInfo *root, const CompressionInfo *info, Pat * in a parallel plan we only set parallel_safe to true * when parallel_workers is greater than 0 which is only * the case when creating partial paths. */ - path->custom_path.path.parallel_safe = compressed_path->parallel_workers > 0; - path->custom_path.path.parallel_workers = compressed_path->parallel_workers; path->custom_path.path.parallel_aware = false; + path->custom_path.path.parallel_safe = + info->chunk_rel->consider_parallel && compressed_path->parallel_safe; + path->custom_path.path.parallel_workers = compressed_path->parallel_workers; path->custom_path.custom_paths = list_make1(compressed_path); path->reverse = false; From 8528478ac60f984f3d577fd822ea922c46a326d4 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:22:33 +0100 Subject: [PATCH 142/157] benchmark unsorted paths (2024-12-17 no. 2) From ae8149afaf82ce5125afa895f476ffe6bac56ccf Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:19:06 +0100 Subject: [PATCH 143/157] fix the minmax initplan cost --- .../nodes/decompress_chunk/decompress_chunk.c | 73 ++++++++++++++++--- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 78a60394a27..7de7278cf99 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -770,6 +770,7 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Pat Assert(ts_is_decompress_chunk_path(path)); /* Iterate over the sort_pathkeys and generate all possible useful sorting */ + List *pathkey_exprs = NIL; List *useful_pathkeys = NIL; ListCell *lc; foreach (lc, root->query_pathkeys) @@ -791,6 +792,7 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Pat } useful_pathkeys = lappend(useful_pathkeys, pathkey); + pathkey_exprs = lappend(pathkey_exprs, em_expr); } if (useful_pathkeys == NIL) @@ -810,6 +812,35 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Pat */ DecompressChunkPath *path_copy = copy_decompress_chunk_path((DecompressChunkPath *) path); + /* + * Sorting might require a projection to evaluate the sorting keys. It is + * added during Plan creation by prepare_sort_from_pathkeys(). However, we + * must account for the costs of projection already at the Path stage. + * One synthetic example is calculating min(x1 + x2 + ....), where the argument + * of min() is a heavy expression. We choose between normal aggregation and a + * special optimization for min() added by build_minmax_path(): an InitPlan + * that does ORDER BY + LIMIT 1. The aggregate costs always account + * for calculating the argument expression (see get_agg_clause_costs()). The + * sorting must as well, otherwise the sorting plan will always have lower + * costs, even when it's subpotimal in practice. The sorting cost with + * LIMIT 1 is essentially linear in the number of input tuples (see + * cost_tuplesort()). + * There is another complication: normally, the cost of expressions in + * targetlist is accounted for by the PathTarget.cost. However, the relation + * targetlists don't have the argument expression and only have the plain + * source Vars used there. The expression is added only later by + * apply_scanjoin_target_to_paths(), after we have already chosen the best + * path. Because of this, we have to account for it here in a hacky way. + * For further improvements, we might research what the Postgres declarative + * partitioning code does for this case, because it must have a similar + * problem. + */ + QualCost pathkey_exprs_cost; + cost_qual_eval(&pathkey_exprs_cost, pathkey_exprs, root); + path_copy->custom_path.path.startup_cost += pathkey_exprs_cost.startup; + path_copy->custom_path.path.total_cost += + path_copy->custom_path.path.rows * pathkey_exprs_cost.per_tuple; + Path *sorted_path = (Path *) create_sort_path(root, chunk_rel, (Path *) path_copy, useful_pathkeys, root->limit_tuples); @@ -1179,30 +1210,54 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * whether it has sorting. */ Path *combined_path = NULL; - Path *decompressed_path = lfirst(lc); + Path *decompression_path = lfirst(lc); const int workers = - Max(decompressed_path->parallel_workers, uncompressed_path->parallel_workers); - if (decompressed_path->pathkeys == NIL) + Max(decompression_path->parallel_workers, uncompressed_path->parallel_workers); + if (decompression_path->pathkeys == NIL) { + /* + * Append distinguishes paths that are parallel and not, and uses + * this for cost estimation, so we have to get it right here. + */ + List *parallel_paths = NIL; + List *sequential_paths = NIL; + + if (decompression_path->parallel_workers > 0) + { + parallel_paths = lappend(parallel_paths, decompression_path); + } + else + { + sequential_paths = lappend(sequential_paths, decompression_path); + } + + if (uncompressed_path->parallel_workers > 0) + { + parallel_paths = lappend(parallel_paths, uncompressed_path); + } + else + { + sequential_paths = lappend(sequential_paths, uncompressed_path); + } + combined_path = (Path *) create_append_path(root, chunk_rel, - list_make2(decompressed_path, uncompressed_path), - /* partial_subpaths = */ NIL, + sequential_paths, + parallel_paths, /* pathkeys = */ NIL, req_outer, workers, - ///* parallel_aware = */ false, workers > 0, - decompressed_path->rows + uncompressed_path->rows); + decompression_path->rows + uncompressed_path->rows); } else if (workers == 0) { combined_path = (Path *) create_merge_append_path(root, chunk_rel, - list_make2(decompressed_path, uncompressed_path), - decompressed_path->pathkeys, + list_make2(decompression_path, uncompressed_path), + decompression_path->pathkeys, req_outer); } else From 81d4d85fda8df9f9a82e5067e8ef9fdf28f06f32 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:20:21 +0100 Subject: [PATCH 144/157] benchmark unsorted paths (2024-12-18 no. 3) From 6ca71432c8a331bd3499f6b1793c880011952f19 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:54:19 +0100 Subject: [PATCH 145/157] some fixes and gather over sort --- tsl/src/chunkwise_agg.c | 125 +- .../nodes/decompress_chunk/decompress_chunk.c | 19 +- tsl/test/expected/compression.out | 57 +- tsl/test/expected/vectorized_aggregation.out | 1502 ++++++++--------- tsl/test/sql/compression.sql | 26 +- tsl/test/sql/vectorized_aggregation.sql | 2 + 6 files changed, 842 insertions(+), 889 deletions(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index 777bcf5a7ba..ce19f2449bf 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -512,23 +512,6 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI hashed_subpaths, partial_grouping_target)); } - - /* Finish the partial paths (just added by add_partial_path to partially_grouped_rel in this - * function) by adding a gather node and add this path to the partially_grouped_rel using - * add_path). */ - foreach (lc, partially_grouped_rel->partial_pathlist) - { - Path *append_path = lfirst(lc); - double total_groups = append_path->rows * append_path->parallel_workers; - - Path *gather_path = (Path *) create_gather_path(root, - partially_grouped_rel, - append_path, - partially_grouped_rel->reltarget, - NULL, - &total_groups); - add_path(partially_grouped_rel, (Path *) gather_path); - } } } @@ -724,65 +707,91 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re } /* Replan aggregation if we were able to generate partially grouped rel paths */ - if (partially_grouped_rel->pathlist == NIL) + List *partially_grouped_paths = + list_concat(partially_grouped_rel->pathlist, partially_grouped_rel->partial_pathlist); + if (partially_grouped_paths == NIL) return; /* Prefer our paths */ output_rel->pathlist = NIL; output_rel->partial_pathlist = NIL; - /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top - * of them. */ + /* + * Finalize the created partially aggregated paths by adding a + * 'Finalize Aggregate' node on top of them, and adding Sort and Gather + * nodes as required. + */ AggClauseCosts *agg_final_costs = &extra_data->agg_final_costs; - foreach (lc, partially_grouped_rel->pathlist) + foreach (lc, partially_grouped_paths) { - Path *append_path = lfirst(lc); - - if (contains_path_plain_or_sorted_agg(append_path)) + Path *partially_aggregated_path = lfirst(lc); + AggStrategy final_strategy; + if (contains_path_plain_or_sorted_agg(partially_aggregated_path)) { - bool is_sorted; - - is_sorted = pathkeys_contained_in(root->group_pathkeys, append_path->pathkeys); - + const bool is_sorted = + pathkeys_contained_in(root->group_pathkeys, partially_aggregated_path->pathkeys); if (!is_sorted) { - append_path = (Path *) - create_sort_path(root, output_rel, append_path, root->group_pathkeys, -1.0); + partially_aggregated_path = (Path *) create_sort_path(root, + output_rel, + partially_aggregated_path, + root->group_pathkeys, + -1.0); } - add_path(output_rel, - (Path *) create_agg_path(root, - output_rel, - append_path, - grouping_target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, - AGGSPLIT_FINAL_DESERIAL, -#if PG16_LT - parse->groupClause, -#else - root->processed_groupClause, -#endif - (List *) parse->havingQual, - agg_final_costs, - d_num_groups)); + final_strategy = parse->groupClause ? AGG_SORTED : AGG_PLAIN; } else { - add_path(output_rel, - (Path *) create_agg_path(root, - output_rel, - append_path, - grouping_target, - AGG_HASHED, - AGGSPLIT_FINAL_DESERIAL, + final_strategy = AGG_HASHED; + } + + /* + * We have to add a Gather or Gather Merge on top of parallel plans. It + * goes above the Sort we might have added just before, so that the Sort + * is paralellized as well. + */ + if (partially_aggregated_path->parallel_workers > 0) + { + double total_groups = + partially_aggregated_path->rows * partially_aggregated_path->parallel_workers; + if (partially_aggregated_path->pathkeys == NIL) + { + partially_aggregated_path = + (Path *) create_gather_path(root, + partially_grouped_rel, + partially_aggregated_path, + partially_grouped_rel->reltarget, + /* required_outer = */ NULL, + &total_groups); + } + else + { + partially_aggregated_path = + (Path *) create_gather_merge_path(root, + partially_grouped_rel, + partially_aggregated_path, + partially_grouped_rel->reltarget, + partially_aggregated_path->pathkeys, + /* required_outer = */ NULL, + &total_groups); + } + } + + add_path(output_rel, + (Path *) create_agg_path(root, + output_rel, + partially_aggregated_path, + grouping_target, + final_strategy, + AGGSPLIT_FINAL_DESERIAL, #if PG16_LT - parse->groupClause, + parse->groupClause, #else - root->processed_groupClause, + root->processed_groupClause, #endif - (List *) parse->havingQual, - agg_final_costs, - d_num_groups)); - } + (List *) parse->havingQual, + agg_final_costs, + d_num_groups)); } } diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 7de7278cf99..2e068452a4f 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -1208,16 +1208,25 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * Combine decompressed path with uncompressed part of the chunk, * using either MergeAppend or plain Append, depending on * whether it has sorting. + * + * Another consideration is parallel plans. Postgres currently doesn't + * use MergeAppend under GatherMerge, i.e. as part of parallel plans. + * This is mostly relevant to the append over chunks which is created by + * Postgres. Here we are creating a MergeAppend for a partial chunk, + * parallelizing it by itself is probably less important, so in this + * case we just create a plain Append instead of MergeAppend even for + * ordered chunk paths. */ Path *combined_path = NULL; Path *decompression_path = lfirst(lc); const int workers = Max(decompression_path->parallel_workers, uncompressed_path->parallel_workers); - if (decompression_path->pathkeys == NIL) + if (decompression_path->pathkeys == NIL || workers > 0) { /* * Append distinguishes paths that are parallel and not, and uses - * this for cost estimation, so we have to get it right here. + * this for cost estimation, so we have to distinguish them as well + * here. */ List *parallel_paths = NIL; List *sequential_paths = NIL; @@ -1251,7 +1260,7 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf workers > 0, decompression_path->rows + uncompressed_path->rows); } - else if (workers == 0) + else { combined_path = (Path *) create_merge_append_path(root, @@ -1260,10 +1269,6 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf decompression_path->pathkeys, req_outer); } - else - { - continue; - } combined_paths = lappend(combined_paths, combined_path); } diff --git a/tsl/test/expected/compression.out b/tsl/test/expected/compression.out index fc5e0ec56db..63d9701ed05 100644 --- a/tsl/test/expected/compression.out +++ b/tsl/test/expected/compression.out @@ -1766,35 +1766,18 @@ SELECT compress_chunk(i) FROM show_chunks('f_sensor_data') i; CALL reindex_compressed_hypertable('f_sensor_data'); VACUUM ANALYZE f_sensor_data; -- Encourage use of parallel plans +SET max_parallel_workers_per_gather = 4; +SET min_parallel_index_scan_size = 0; +SET min_parallel_table_scan_size = 0; SET parallel_setup_cost = 0; SET parallel_tuple_cost = 0; -SET min_parallel_table_scan_size TO '0'; -\set explain 'EXPLAIN (VERBOSE, COSTS OFF)' -SHOW min_parallel_table_scan_size; - min_parallel_table_scan_size ------------------------------- - 0 -(1 row) - SHOW max_parallel_workers; max_parallel_workers ---------------------- 8 (1 row) -SHOW max_parallel_workers_per_gather; - max_parallel_workers_per_gather ---------------------------------- - 2 -(1 row) - -SET max_parallel_workers_per_gather = 4; -SHOW max_parallel_workers_per_gather; - max_parallel_workers_per_gather ---------------------------------- - 4 -(1 row) - +\set explain 'EXPLAIN (VERBOSE, COSTS OFF)' -- We disable enable_parallel_append here to ensure -- that we create the same query plan in all PG 14.X versions SET enable_parallel_append = false; @@ -1816,24 +1799,19 @@ SELECT sum(cpu) FROM f_sensor_data; Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature (12 rows) --- Encourage use of Index Scan -SET enable_seqscan = false; -SET enable_indexscan = true; -SET min_parallel_index_scan_size = 0; -SET min_parallel_table_scan_size = 0; CREATE INDEX ON f_sensor_data (time, sensor_id); :explain -SELECT * FROM f_sensor_data WHERE sensor_id > 100; +SELECT * FROM f_sensor_data WHERE sensor_id > 1000; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Gather Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature - Workers Planned: 3 + Workers Planned: 2 -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_73_chunk Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature -> Parallel Index Scan using compress_hyper_38_74_chunk_sensor_id__ts_meta_min_1__ts_met_idx on _timescaledb_internal.compress_hyper_38_74_chunk Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature - Index Cond: (compress_hyper_38_74_chunk.sensor_id > 100) + Index Cond: (compress_hyper_38_74_chunk.sensor_id > 1000) (8 rows) RESET enable_parallel_append; @@ -1849,6 +1827,7 @@ FROM generate_series(1700, 1800, 1 ) AS g2(sensor_id) ORDER BY time; +VACUUM ANALYZE f_sensor_data; :explain SELECT sum(cpu) FROM f_sensor_data; QUERY PLAN @@ -1859,10 +1838,6 @@ SELECT sum(cpu) FROM f_sensor_data; Output: (PARTIAL sum(_hyper_37_73_chunk.cpu)) Workers Planned: 4 -> Parallel Append - -> Partial Aggregate - Output: PARTIAL sum(_hyper_37_73_chunk.cpu) - -> Parallel Seq Scan on _timescaledb_internal._hyper_37_73_chunk - Output: _hyper_37_73_chunk.cpu -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_37_73_chunk.cpu)) Grouping Policy: all compressed batches @@ -1870,25 +1845,29 @@ SELECT sum(cpu) FROM f_sensor_data; Output: _hyper_37_73_chunk.cpu -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_38_74_chunk Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature + -> Partial Aggregate + Output: PARTIAL sum(_hyper_37_73_chunk.cpu) + -> Parallel Seq Scan on _timescaledb_internal._hyper_37_73_chunk + Output: _hyper_37_73_chunk.cpu (17 rows) :explain -SELECT * FROM f_sensor_data WHERE sensor_id > 100; +SELECT * FROM f_sensor_data WHERE sensor_id > 1000; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Gather Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature Workers Planned: 3 -> Parallel Append - -> Parallel Index Scan using _hyper_37_73_chunk_f_sensor_data_time_sensor_id_idx on _timescaledb_internal._hyper_37_73_chunk - Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature - Index Cond: (_hyper_37_73_chunk.sensor_id > 100) -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_37_73_chunk Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature - Filter: (_hyper_37_73_chunk.sensor_id > 100) + Filter: (_hyper_37_73_chunk.sensor_id > 1000) -> Parallel Index Scan using compress_hyper_38_74_chunk_sensor_id__ts_meta_min_1__ts_met_idx on _timescaledb_internal.compress_hyper_38_74_chunk Output: compress_hyper_38_74_chunk._ts_meta_count, compress_hyper_38_74_chunk.sensor_id, compress_hyper_38_74_chunk._ts_meta_min_1, compress_hyper_38_74_chunk._ts_meta_max_1, compress_hyper_38_74_chunk."time", compress_hyper_38_74_chunk.cpu, compress_hyper_38_74_chunk.temperature - Index Cond: (compress_hyper_38_74_chunk.sensor_id > 100) + Index Cond: (compress_hyper_38_74_chunk.sensor_id > 1000) + -> Parallel Seq Scan on _timescaledb_internal._hyper_37_73_chunk + Output: _hyper_37_73_chunk."time", _hyper_37_73_chunk.sensor_id, _hyper_37_73_chunk.cpu, _hyper_37_73_chunk.temperature + Filter: (_hyper_37_73_chunk.sensor_id > 1000) (13 rows) -- Test non-partial paths below append are not executed multiple times diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 01f690b743a..877f8bcfd96 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -40,6 +40,7 @@ SELECT compress_chunk(ch) FROM show_chunks('testtable') ch LIMIT 3; _timescaledb_internal._hyper_1_3_chunk (3 rows) +VACUUM ANALYZE testtable; -- Vectorized aggregation possible SELECT sum(segment_by_value) FROM testtable; sum @@ -49,635 +50,608 @@ SELECT sum(segment_by_value) FROM testtable; :EXPLAIN SELECT sum(segment_by_value) FROM testtable; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value -(55 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value +(52 rows) -- Vectorization possible - filter on segment_by :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: (_hyper_1_4_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: (_hyper_1_5_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: (_hyper_1_6_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: (_hyper_1_7_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: (_hyper_1_8_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: (_hyper_1_9_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: (_hyper_1_10_chunk.segment_by_value > 0) -(65 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: (_hyper_1_4_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: (_hyper_1_5_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: (_hyper_1_6_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: (_hyper_1_7_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: (_hyper_1_8_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: (_hyper_1_9_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: (_hyper_1_10_chunk.segment_by_value > 0) +(62 rows) -- Vectorization with filter on compressed columns :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE segment_by_value > 0 AND int_value > 0; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) -(68 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + Filter: (compress_hyper_2_11_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + Filter: (compress_hyper_2_12_chunk.segment_by_value > 0) + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + Filter: (compress_hyper_2_13_chunk.segment_by_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: ((_hyper_1_4_chunk.segment_by_value > 0) AND (_hyper_1_4_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: ((_hyper_1_5_chunk.segment_by_value > 0) AND (_hyper_1_5_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: ((_hyper_1_6_chunk.segment_by_value > 0) AND (_hyper_1_6_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: ((_hyper_1_7_chunk.segment_by_value > 0) AND (_hyper_1_7_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: ((_hyper_1_8_chunk.segment_by_value > 0) AND (_hyper_1_8_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: ((_hyper_1_9_chunk.segment_by_value > 0) AND (_hyper_1_9_chunk.int_value > 0)) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: ((_hyper_1_10_chunk.segment_by_value > 0) AND (_hyper_1_10_chunk.int_value > 0)) +(65 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE int_value > 0; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> 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) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: (_hyper_1_4_chunk.int_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: (_hyper_1_5_chunk.int_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: (_hyper_1_6_chunk.int_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: (_hyper_1_7_chunk.int_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: (_hyper_1_8_chunk.int_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: (_hyper_1_9_chunk.int_value > 0) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: (_hyper_1_10_chunk.int_value > 0) -(65 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> 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) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: (_hyper_1_4_chunk.int_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: (_hyper_1_5_chunk.int_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: (_hyper_1_6_chunk.int_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: (_hyper_1_7_chunk.int_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: (_hyper_1_8_chunk.int_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: (_hyper_1_9_chunk.int_value > 0) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: (_hyper_1_10_chunk.int_value > 0) +(62 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable WHERE float_value > 0; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.segment_by_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - Vectorized Filter: (_hyper_1_1_chunk.float_value > '0'::double precision) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - Vectorized Filter: (_hyper_1_2_chunk.float_value > '0'::double precision) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - Vectorized Filter: (_hyper_1_3_chunk.float_value > '0'::double precision) - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - Filter: (_hyper_1_4_chunk.float_value > '0'::double precision) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - Filter: (_hyper_1_5_chunk.float_value > '0'::double precision) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - Filter: (_hyper_1_6_chunk.float_value > '0'::double precision) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - Filter: (_hyper_1_7_chunk.float_value > '0'::double precision) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - Filter: (_hyper_1_8_chunk.float_value > '0'::double precision) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - Filter: (_hyper_1_9_chunk.float_value > '0'::double precision) - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value - Filter: (_hyper_1_10_chunk.float_value > '0'::double precision) -(65 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + Vectorized Filter: (_hyper_1_1_chunk.float_value > '0'::double precision) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + Vectorized Filter: (_hyper_1_2_chunk.float_value > '0'::double precision) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + Vectorized Filter: (_hyper_1_3_chunk.float_value > '0'::double precision) + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + Filter: (_hyper_1_4_chunk.float_value > '0'::double precision) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + Filter: (_hyper_1_5_chunk.float_value > '0'::double precision) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + Filter: (_hyper_1_6_chunk.float_value > '0'::double precision) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + Filter: (_hyper_1_7_chunk.float_value > '0'::double precision) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + Filter: (_hyper_1_8_chunk.float_value > '0'::double precision) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + Filter: (_hyper_1_9_chunk.float_value > '0'::double precision) + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value + Filter: (_hyper_1_10_chunk.float_value > '0'::double precision) +(62 rows) -- Vectorization not possible due grouping :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY float_value; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.float_value Group Key: _hyper_1_1_chunk.float_value - -> Gather - Output: _hyper_1_1_chunk.float_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Partial HashAggregate - Output: _hyper_1_1_chunk.float_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) - Group Key: _hyper_1_1_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.float_value, _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_2_chunk.float_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) - Group Key: _hyper_1_2_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.float_value, _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_3_chunk.float_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) - Group Key: _hyper_1_3_chunk.float_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.float_value, _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_4_chunk.float_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - Group Key: _hyper_1_4_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.float_value, _hyper_1_4_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_5_chunk.float_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - Group Key: _hyper_1_5_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.float_value, _hyper_1_5_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_6_chunk.float_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - Group Key: _hyper_1_6_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.float_value, _hyper_1_6_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_7_chunk.float_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - Group Key: _hyper_1_7_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.float_value, _hyper_1_7_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_8_chunk.float_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - Group Key: _hyper_1_8_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.float_value, _hyper_1_8_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_9_chunk.float_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - Group Key: _hyper_1_9_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.float_value, _hyper_1_9_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_10_chunk.float_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - Group Key: _hyper_1_10_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.float_value, _hyper_1_10_chunk.segment_by_value -(63 rows) + -> Append + -> Partial HashAggregate + Output: _hyper_1_1_chunk.float_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) + Group Key: _hyper_1_1_chunk.float_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.float_value, _hyper_1_1_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.float_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) + Group Key: _hyper_1_2_chunk.float_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.float_value, _hyper_1_2_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.float_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) + Group Key: _hyper_1_3_chunk.float_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.float_value, _hyper_1_3_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.float_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.float_value, _hyper_1_4_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.float_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.float_value, _hyper_1_5_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.float_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.float_value, _hyper_1_6_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.float_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.float_value, _hyper_1_7_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.float_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.float_value, _hyper_1_8_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.float_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.float_value, _hyper_1_9_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.float_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.float_value + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.float_value, _hyper_1_10_chunk.segment_by_value +(60 rows) :EXPLAIN SELECT sum(segment_by_value) FROM testtable GROUP BY int_value; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.int_value Group Key: _hyper_1_1_chunk.int_value - -> Gather - Output: _hyper_1_1_chunk.int_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Partial HashAggregate - Output: _hyper_1_1_chunk.int_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) - Group Key: _hyper_1_1_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_2_chunk.int_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) - Group Key: _hyper_1_2_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_3_chunk.int_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) - Group Key: _hyper_1_3_chunk.int_value - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_4_chunk.int_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - Group Key: _hyper_1_4_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_5_chunk.int_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - Group Key: _hyper_1_5_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_6_chunk.int_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - Group Key: _hyper_1_6_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_7_chunk.int_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - Group Key: _hyper_1_7_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_8_chunk.int_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - Group Key: _hyper_1_8_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_9_chunk.int_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - Group Key: _hyper_1_9_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_10_chunk.int_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - Group Key: _hyper_1_10_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value -(63 rows) + -> Append + -> Partial HashAggregate + Output: _hyper_1_1_chunk.int_value, PARTIAL sum(_hyper_1_1_chunk.segment_by_value) + Group Key: _hyper_1_1_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.int_value, _hyper_1_1_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_2_chunk.int_value, PARTIAL sum(_hyper_1_2_chunk.segment_by_value) + Group Key: _hyper_1_2_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.int_value, _hyper_1_2_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_3_chunk.int_value, PARTIAL sum(_hyper_1_3_chunk.segment_by_value) + Group Key: _hyper_1_3_chunk.int_value + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.int_value, _hyper_1_3_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.int_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.int_value, _hyper_1_4_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.int_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.int_value, _hyper_1_5_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.int_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.int_value, _hyper_1_6_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.int_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.int_value, _hyper_1_7_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.int_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.int_value, _hyper_1_8_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.int_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.int_value, _hyper_1_9_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.int_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.int_value, _hyper_1_10_chunk.segment_by_value +(60 rows) -- Vectorization possible with grouping by a segmentby column. :EXPLAIN SELECT sum(int_value) FROM testtable GROUP BY segment_by_value; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize HashAggregate Output: sum(_hyper_1_1_chunk.int_value), _hyper_1_1_chunk.segment_by_value Group Key: _hyper_1_1_chunk.segment_by_value - -> Gather - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) - Workers Planned: 2 - -> Parallel Append + -> Append + -> Custom Scan (VectorAgg) + Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) + Grouping Policy: per compressed batch + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: _hyper_1_2_chunk.segment_by_value, (PARTIAL sum(_hyper_1_2_chunk.int_value)) + Grouping Policy: per compressed batch + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: _hyper_1_3_chunk.segment_by_value, (PARTIAL sum(_hyper_1_3_chunk.int_value)) + Grouping Policy: per compressed batch + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.int_value) + Group Key: _hyper_1_4_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.int_value) + Group Key: _hyper_1_5_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.int_value) + Group Key: _hyper_1_6_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.int_value) + Group Key: _hyper_1_7_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.int_value) + Group Key: _hyper_1_8_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.int_value) + Group Key: _hyper_1_9_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.int_value) + Group Key: _hyper_1_10_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value +(60 rows) + +:EXPLAIN +SELECT sum(segment_by_value), segment_by_value FROM testtable GROUP BY segment_by_value ORDER BY 1, 2; + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort + Output: (sum(_hyper_1_1_chunk.segment_by_value)), _hyper_1_1_chunk.segment_by_value + Sort Key: (sum(_hyper_1_1_chunk.segment_by_value)), _hyper_1_1_chunk.segment_by_value + -> Finalize HashAggregate + Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.segment_by_value + Group Key: _hyper_1_1_chunk.segment_by_value + -> Append -> Custom Scan (VectorAgg) - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.int_value)) + Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) Grouping Policy: per compressed batch -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value, _hyper_1_1_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value -> Custom Scan (VectorAgg) - Output: _hyper_1_2_chunk.segment_by_value, (PARTIAL sum(_hyper_1_2_chunk.int_value)) + Output: _hyper_1_2_chunk.segment_by_value, (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) Grouping Policy: per compressed batch -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value, _hyper_1_2_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value -> Custom Scan (VectorAgg) - Output: _hyper_1_3_chunk.segment_by_value, (PARTIAL sum(_hyper_1_3_chunk.int_value)) + Output: _hyper_1_3_chunk.segment_by_value, (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) Grouping Policy: per compressed batch -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value, _hyper_1_3_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value -> Partial HashAggregate - Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.int_value) + Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) Group Key: _hyper_1_4_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value, _hyper_1_4_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value -> Partial HashAggregate - Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.int_value) + Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) Group Key: _hyper_1_5_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value, _hyper_1_5_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value -> Partial HashAggregate - Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.int_value) + Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) Group Key: _hyper_1_6_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value, _hyper_1_6_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value -> Partial HashAggregate - Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.int_value) + Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) Group Key: _hyper_1_7_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value, _hyper_1_7_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value -> Partial HashAggregate - Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.int_value) + Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) Group Key: _hyper_1_8_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value, _hyper_1_8_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value -> Partial HashAggregate - Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.int_value) + Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) Group Key: _hyper_1_9_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value, _hyper_1_9_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value -> Partial HashAggregate - Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.int_value) + Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) Group Key: _hyper_1_10_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value, _hyper_1_10_chunk.int_value + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value (63 rows) -:EXPLAIN -SELECT sum(segment_by_value), segment_by_value FROM testtable GROUP BY segment_by_value ORDER BY 1, 2; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Sort - Output: (sum(_hyper_1_1_chunk.segment_by_value)), _hyper_1_1_chunk.segment_by_value - Sort Key: (sum(_hyper_1_1_chunk.segment_by_value)), _hyper_1_1_chunk.segment_by_value - -> Finalize HashAggregate - Output: sum(_hyper_1_1_chunk.segment_by_value), _hyper_1_1_chunk.segment_by_value - Group Key: _hyper_1_1_chunk.segment_by_value - -> Gather - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: per compressed batch - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: _hyper_1_2_chunk.segment_by_value, (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: per compressed batch - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: _hyper_1_3_chunk.segment_by_value, (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: per compressed batch - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - Group Key: _hyper_1_4_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - Group Key: _hyper_1_5_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - Group Key: _hyper_1_6_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - Group Key: _hyper_1_7_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - Group Key: _hyper_1_8_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - Group Key: _hyper_1_9_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - Group Key: _hyper_1_10_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value -(66 rows) - SELECT sum(segment_by_value), segment_by_value FROM testtable GROUP BY segment_by_value ORDER BY 1, 2; sum | segment_by_value ------+------------------ @@ -796,75 +770,72 @@ SELECT sum(segment_by_value), segment_by_value FROM testtable GROUP BY segment_b :EXPLAIN SELECT segment_by_value, sum(segment_by_value) FROM testtable GROUP BY segment_by_value ORDER BY 1, 2; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort Output: _hyper_1_1_chunk.segment_by_value, (sum(_hyper_1_1_chunk.segment_by_value)) Sort Key: _hyper_1_1_chunk.segment_by_value, (sum(_hyper_1_1_chunk.segment_by_value)) -> Finalize HashAggregate Output: _hyper_1_1_chunk.segment_by_value, sum(_hyper_1_1_chunk.segment_by_value) Group Key: _hyper_1_1_chunk.segment_by_value - -> Gather - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) - Grouping Policy: per compressed batch - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: _hyper_1_2_chunk.segment_by_value, (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) - Grouping Policy: per compressed batch - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: _hyper_1_3_chunk.segment_by_value, (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) - Grouping Policy: per compressed batch - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial HashAggregate - Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) - Group Key: _hyper_1_4_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) - Group Key: _hyper_1_5_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) - Group Key: _hyper_1_6_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) - Group Key: _hyper_1_7_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) - Group Key: _hyper_1_8_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) - Group Key: _hyper_1_9_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.segment_by_value - -> Partial HashAggregate - Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) - Group Key: _hyper_1_10_chunk.segment_by_value - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.segment_by_value -(66 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: _hyper_1_1_chunk.segment_by_value, (PARTIAL sum(_hyper_1_1_chunk.segment_by_value)) + Grouping Policy: per compressed batch + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: _hyper_1_2_chunk.segment_by_value, (PARTIAL sum(_hyper_1_2_chunk.segment_by_value)) + Grouping Policy: per compressed batch + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: _hyper_1_3_chunk.segment_by_value, (PARTIAL sum(_hyper_1_3_chunk.segment_by_value)) + Grouping Policy: per compressed batch + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial HashAggregate + Output: _hyper_1_4_chunk.segment_by_value, PARTIAL sum(_hyper_1_4_chunk.segment_by_value) + Group Key: _hyper_1_4_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_5_chunk.segment_by_value, PARTIAL sum(_hyper_1_5_chunk.segment_by_value) + Group Key: _hyper_1_5_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_6_chunk.segment_by_value, PARTIAL sum(_hyper_1_6_chunk.segment_by_value) + Group Key: _hyper_1_6_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_7_chunk.segment_by_value, PARTIAL sum(_hyper_1_7_chunk.segment_by_value) + Group Key: _hyper_1_7_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_8_chunk.segment_by_value, PARTIAL sum(_hyper_1_8_chunk.segment_by_value) + Group Key: _hyper_1_8_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_9_chunk.segment_by_value, PARTIAL sum(_hyper_1_9_chunk.segment_by_value) + Group Key: _hyper_1_9_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.segment_by_value + -> Partial HashAggregate + Output: _hyper_1_10_chunk.segment_by_value, PARTIAL sum(_hyper_1_10_chunk.segment_by_value) + Group Key: _hyper_1_10_chunk.segment_by_value + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.segment_by_value +(63 rows) SELECT segment_by_value, sum(segment_by_value) FROM testtable GROUP BY segment_by_value ORDER BY 1, 2; segment_by_value | sum @@ -991,64 +962,61 @@ SELECT sum(int_value) FROM testtable; :EXPLAIN SELECT sum(int_value) FROM testtable; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.int_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.int_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.int_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.int_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.int_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.int_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.int_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.int_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.int_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.int_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.int_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.int_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.int_value -(55 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.int_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.int_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.int_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.int_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.int_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.int_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.int_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.int_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.int_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.int_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.int_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.int_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.int_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.int_value +(52 rows) -- Vectorized aggregation possible SELECT sum(float_value) FROM testtable; @@ -1059,64 +1027,61 @@ SELECT sum(float_value) FROM testtable; :EXPLAIN SELECT sum(float_value) FROM testtable; - QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize Aggregate Output: sum(_hyper_1_1_chunk.float_value) - -> Gather - Output: (PARTIAL sum(_hyper_1_1_chunk.float_value)) - Workers Planned: 2 - -> Parallel Append - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_1_chunk.float_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk - Output: _hyper_1_1_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk - Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_2_chunk.float_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk - Output: _hyper_1_2_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk - Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value - -> Custom Scan (VectorAgg) - Output: (PARTIAL sum(_hyper_1_3_chunk.float_value)) - Grouping Policy: all compressed batches - -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk - Output: _hyper_1_3_chunk.float_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk - Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_4_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_4_chunk - Output: _hyper_1_4_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_5_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_5_chunk - Output: _hyper_1_5_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_6_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_6_chunk - Output: _hyper_1_6_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_7_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_7_chunk - Output: _hyper_1_7_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_8_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_8_chunk - Output: _hyper_1_8_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_9_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_9_chunk - Output: _hyper_1_9_chunk.float_value - -> Partial Aggregate - Output: PARTIAL sum(_hyper_1_10_chunk.float_value) - -> Parallel Seq Scan on _timescaledb_internal._hyper_1_10_chunk - Output: _hyper_1_10_chunk.float_value -(55 rows) + -> Append + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_1_chunk.float_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_1_chunk + Output: _hyper_1_1_chunk.float_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_11_chunk + Output: compress_hyper_2_11_chunk._ts_meta_count, compress_hyper_2_11_chunk.segment_by_value, compress_hyper_2_11_chunk._ts_meta_min_1, compress_hyper_2_11_chunk._ts_meta_max_1, compress_hyper_2_11_chunk."time", compress_hyper_2_11_chunk.int_value, compress_hyper_2_11_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_2_chunk.float_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_2_chunk + Output: _hyper_1_2_chunk.float_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_12_chunk + Output: compress_hyper_2_12_chunk._ts_meta_count, compress_hyper_2_12_chunk.segment_by_value, compress_hyper_2_12_chunk._ts_meta_min_1, compress_hyper_2_12_chunk._ts_meta_max_1, compress_hyper_2_12_chunk."time", compress_hyper_2_12_chunk.int_value, compress_hyper_2_12_chunk.float_value + -> Custom Scan (VectorAgg) + Output: (PARTIAL sum(_hyper_1_3_chunk.float_value)) + Grouping Policy: all compressed batches + -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_3_chunk + Output: _hyper_1_3_chunk.float_value + -> Seq Scan on _timescaledb_internal.compress_hyper_2_13_chunk + Output: compress_hyper_2_13_chunk._ts_meta_count, compress_hyper_2_13_chunk.segment_by_value, compress_hyper_2_13_chunk._ts_meta_min_1, compress_hyper_2_13_chunk._ts_meta_max_1, compress_hyper_2_13_chunk."time", compress_hyper_2_13_chunk.int_value, compress_hyper_2_13_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_4_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_4_chunk + Output: _hyper_1_4_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_5_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_5_chunk + Output: _hyper_1_5_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_6_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_6_chunk + Output: _hyper_1_6_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_7_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_7_chunk + Output: _hyper_1_7_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_8_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_8_chunk + Output: _hyper_1_8_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_9_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_9_chunk + Output: _hyper_1_9_chunk.float_value + -> Partial Aggregate + Output: PARTIAL sum(_hyper_1_10_chunk.float_value) + -> Seq Scan on _timescaledb_internal._hyper_1_10_chunk + Output: _hyper_1_10_chunk.float_value +(52 rows) --- -- Tests with all chunks compressed @@ -1139,6 +1104,7 @@ NOTICE: chunk "_hyper_1_3_chunk" is already compressed _timescaledb_internal._hyper_1_10_chunk (10 rows) +VACUUM ANALYZE testtable; -- Vectorized aggregation possible SELECT sum(segment_by_value) FROM testtable; sum @@ -3265,73 +3231,73 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: _hyper_3_101_chunk.segment_by_value1 - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_4_110_chunk + -> Index Scan using compress_hyper_4_110_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_110_chunk Output: compress_hyper_4_110_chunk._ts_meta_count, compress_hyper_4_110_chunk.segment_by_value1, compress_hyper_4_110_chunk.segment_by_value2, compress_hyper_4_110_chunk._ts_meta_min_1, compress_hyper_4_110_chunk._ts_meta_max_1, compress_hyper_4_110_chunk."time", compress_hyper_4_110_chunk.int_value, compress_hyper_4_110_chunk.float_value - Filter: ((compress_hyper_4_110_chunk.segment_by_value1 > 0) AND (compress_hyper_4_110_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_110_chunk.segment_by_value1 > 0) AND (compress_hyper_4_110_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_102_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: _hyper_3_102_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1, compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value - Filter: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_103_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: _hyper_3_103_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1, compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value - Filter: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_104_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: _hyper_3_104_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1, compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value - Filter: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_105_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: _hyper_3_105_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1, compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value - Filter: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_106_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: _hyper_3_106_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1, compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value - Filter: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_107_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: _hyper_3_107_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1, compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value - Filter: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_108_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: _hyper_3_108_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1, compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value - Filter: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_109_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: _hyper_3_109_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1, compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value - Filter: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) (78 rows) :EXPLAIN @@ -3349,73 +3315,73 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: _hyper_3_101_chunk.segment_by_value1 - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_4_110_chunk + -> Index Scan using compress_hyper_4_110_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_110_chunk Output: compress_hyper_4_110_chunk._ts_meta_count, compress_hyper_4_110_chunk.segment_by_value1, compress_hyper_4_110_chunk.segment_by_value2, compress_hyper_4_110_chunk._ts_meta_min_1, compress_hyper_4_110_chunk._ts_meta_max_1, compress_hyper_4_110_chunk."time", compress_hyper_4_110_chunk.int_value, compress_hyper_4_110_chunk.float_value - Filter: ((compress_hyper_4_110_chunk.segment_by_value1 > 0) AND (compress_hyper_4_110_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_110_chunk.segment_by_value1 > 0) AND (compress_hyper_4_110_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_102_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: _hyper_3_102_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1, compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value - Filter: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_103_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: _hyper_3_103_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1, compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value - Filter: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_104_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: _hyper_3_104_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1, compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value - Filter: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_105_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: _hyper_3_105_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1, compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value - Filter: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_106_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: _hyper_3_106_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1, compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value - Filter: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_107_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: _hyper_3_107_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1, compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value - Filter: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_108_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: _hyper_3_108_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1, compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value - Filter: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_3_109_chunk.segment_by_value1)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: _hyper_3_109_chunk.segment_by_value1 - -> Parallel Seq Scan 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._ts_meta_count, compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1, compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value - Filter: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) + Index Cond: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) (78 rows) -- Vectorization not possible filter on segment_by and compressed value diff --git a/tsl/test/sql/compression.sql b/tsl/test/sql/compression.sql index adb7b81f07b..16541a12b37 100644 --- a/tsl/test/sql/compression.sql +++ b/tsl/test/sql/compression.sql @@ -797,18 +797,14 @@ CALL reindex_compressed_hypertable('f_sensor_data'); VACUUM ANALYZE f_sensor_data; -- Encourage use of parallel plans +SET max_parallel_workers_per_gather = 4; +SET min_parallel_index_scan_size = 0; +SET min_parallel_table_scan_size = 0; SET parallel_setup_cost = 0; SET parallel_tuple_cost = 0; -SET min_parallel_table_scan_size TO '0'; - -\set explain 'EXPLAIN (VERBOSE, COSTS OFF)' - -SHOW min_parallel_table_scan_size; SHOW max_parallel_workers; -SHOW max_parallel_workers_per_gather; -SET max_parallel_workers_per_gather = 4; -SHOW max_parallel_workers_per_gather; +\set explain 'EXPLAIN (VERBOSE, COSTS OFF)' -- We disable enable_parallel_append here to ensure -- that we create the same query plan in all PG 14.X versions @@ -817,16 +813,10 @@ SET enable_parallel_append = false; :explain SELECT sum(cpu) FROM f_sensor_data; --- Encourage use of Index Scan - -SET enable_seqscan = false; -SET enable_indexscan = true; -SET min_parallel_index_scan_size = 0; -SET min_parallel_table_scan_size = 0; - CREATE INDEX ON f_sensor_data (time, sensor_id); + :explain -SELECT * FROM f_sensor_data WHERE sensor_id > 100; +SELECT * FROM f_sensor_data WHERE sensor_id > 1000; RESET enable_parallel_append; @@ -844,11 +834,13 @@ FROM ORDER BY time; +VACUUM ANALYZE f_sensor_data; + :explain SELECT sum(cpu) FROM f_sensor_data; :explain -SELECT * FROM f_sensor_data WHERE sensor_id > 100; +SELECT * FROM f_sensor_data WHERE sensor_id > 1000; -- Test non-partial paths below append are not executed multiple times diff --git a/tsl/test/sql/vectorized_aggregation.sql b/tsl/test/sql/vectorized_aggregation.sql index 324a96716f5..05f33c0422f 100644 --- a/tsl/test/sql/vectorized_aggregation.sql +++ b/tsl/test/sql/vectorized_aggregation.sql @@ -31,6 +31,7 @@ SELECT sum(segment_by_value), sum(int_value), sum(float_value) FROM testtable; -- Tests with some chunks compressed --- SELECT compress_chunk(ch) FROM show_chunks('testtable') ch LIMIT 3; +VACUUM ANALYZE testtable; -- Vectorized aggregation possible SELECT sum(segment_by_value) FROM testtable; @@ -89,6 +90,7 @@ SELECT sum(float_value) FROM testtable; -- Tests with all chunks compressed --- SELECT compress_chunk(ch, if_not_compressed => true) FROM show_chunks('testtable') ch; +VACUUM ANALYZE testtable; -- Vectorized aggregation possible SELECT sum(segment_by_value) FROM testtable; From 21bfc855ad716ef57af293ac1995dc965c327378 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:12:54 +0100 Subject: [PATCH 146/157] Revert "Chunk-wise agg: add Gather above Sort" This reverts commit e94bd260aa714b49e03d303769e10630e91094c7. --- tsl/src/chunkwise_agg.c | 129 +++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 69 deletions(-) diff --git a/tsl/src/chunkwise_agg.c b/tsl/src/chunkwise_agg.c index ce19f2449bf..5d319e5f4b2 100644 --- a/tsl/src/chunkwise_agg.c +++ b/tsl/src/chunkwise_agg.c @@ -437,7 +437,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI copy_append_like_path(root, partially_compressed_append, partially_compressed_sorted, - partial_grouping_target)); + subpath->pathtarget)); } if (can_hash) @@ -446,7 +446,7 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI copy_append_like_path(root, partially_compressed_append, partially_compressed_hashed, - partial_grouping_target)); + subpath->pathtarget)); } } else @@ -512,6 +512,23 @@ generate_agg_pushdown_path(PlannerInfo *root, Path *cheapest_total_path, RelOptI hashed_subpaths, partial_grouping_target)); } + + /* Finish the partial paths (just added by add_partial_path to partially_grouped_rel in this + * function) by adding a gather node and add this path to the partially_grouped_rel using + * add_path). */ + foreach (lc, partially_grouped_rel->partial_pathlist) + { + Path *append_path = lfirst(lc); + double total_groups = append_path->rows * append_path->parallel_workers; + + Path *gather_path = (Path *) create_gather_path(root, + partially_grouped_rel, + append_path, + partially_grouped_rel->reltarget, + NULL, + &total_groups); + add_path(partially_grouped_rel, (Path *) gather_path); + } } } @@ -707,91 +724,65 @@ tsl_pushdown_partial_agg(PlannerInfo *root, Hypertable *ht, RelOptInfo *input_re } /* Replan aggregation if we were able to generate partially grouped rel paths */ - List *partially_grouped_paths = - list_concat(partially_grouped_rel->pathlist, partially_grouped_rel->partial_pathlist); - if (partially_grouped_paths == NIL) + if (partially_grouped_rel->pathlist == NIL) return; /* Prefer our paths */ output_rel->pathlist = NIL; output_rel->partial_pathlist = NIL; - /* - * Finalize the created partially aggregated paths by adding a - * 'Finalize Aggregate' node on top of them, and adding Sort and Gather - * nodes as required. - */ + /* Finalize the created partially aggregated paths by adding a 'Finalize Aggregate' node on top + * of them. */ AggClauseCosts *agg_final_costs = &extra_data->agg_final_costs; - foreach (lc, partially_grouped_paths) + foreach (lc, partially_grouped_rel->pathlist) { - Path *partially_aggregated_path = lfirst(lc); - AggStrategy final_strategy; - if (contains_path_plain_or_sorted_agg(partially_aggregated_path)) + Path *append_path = lfirst(lc); + + if (contains_path_plain_or_sorted_agg(append_path)) { - const bool is_sorted = - pathkeys_contained_in(root->group_pathkeys, partially_aggregated_path->pathkeys); + bool is_sorted; + + is_sorted = pathkeys_contained_in(root->group_pathkeys, append_path->pathkeys); + if (!is_sorted) { - partially_aggregated_path = (Path *) create_sort_path(root, - output_rel, - partially_aggregated_path, - root->group_pathkeys, - -1.0); + append_path = (Path *) + create_sort_path(root, output_rel, append_path, root->group_pathkeys, -1.0); } - final_strategy = parse->groupClause ? AGG_SORTED : AGG_PLAIN; + add_path(output_rel, + (Path *) create_agg_path(root, + output_rel, + append_path, + grouping_target, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, + AGGSPLIT_FINAL_DESERIAL, +#if PG16_LT + parse->groupClause, +#else + root->processed_groupClause, +#endif + (List *) parse->havingQual, + agg_final_costs, + d_num_groups)); } else { - final_strategy = AGG_HASHED; - } - - /* - * We have to add a Gather or Gather Merge on top of parallel plans. It - * goes above the Sort we might have added just before, so that the Sort - * is paralellized as well. - */ - if (partially_aggregated_path->parallel_workers > 0) - { - double total_groups = - partially_aggregated_path->rows * partially_aggregated_path->parallel_workers; - if (partially_aggregated_path->pathkeys == NIL) - { - partially_aggregated_path = - (Path *) create_gather_path(root, - partially_grouped_rel, - partially_aggregated_path, - partially_grouped_rel->reltarget, - /* required_outer = */ NULL, - &total_groups); - } - else - { - partially_aggregated_path = - (Path *) create_gather_merge_path(root, - partially_grouped_rel, - partially_aggregated_path, - partially_grouped_rel->reltarget, - partially_aggregated_path->pathkeys, - /* required_outer = */ NULL, - &total_groups); - } - } - - add_path(output_rel, - (Path *) create_agg_path(root, - output_rel, - partially_aggregated_path, - grouping_target, - final_strategy, - AGGSPLIT_FINAL_DESERIAL, + add_path(output_rel, + (Path *) create_agg_path(root, + output_rel, + append_path, + grouping_target, + AGG_HASHED, + AGGSPLIT_FINAL_DESERIAL, #if PG16_LT - parse->groupClause, + parse->groupClause, #else - root->processed_groupClause, + root->processed_groupClause, #endif - (List *) parse->havingQual, - agg_final_costs, - d_num_groups)); + (List *) parse->havingQual, + agg_final_costs, + d_num_groups)); + } } } From 3916fe0dacebbffced83e30c47c02ab0b6914762 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:15:15 +0100 Subject: [PATCH 147/157] accept the refs --- tsl/test/expected/compression_ddl.out | 135 ++++++++++++++------------ tsl/test/expected/hypercore.out | 18 ++-- 2 files changed, 80 insertions(+), 73 deletions(-) diff --git a/tsl/test/expected/compression_ddl.out b/tsl/test/expected/compression_ddl.out index edb7008c317..1d9e3ac2a61 100644 --- a/tsl/test/expected/compression_ddl.out +++ b/tsl/test/expected/compression_ddl.out @@ -1613,25 +1613,28 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate - Group Key: _hyper_31_110_chunk.device_id - -> Merge Append - Sort Key: _hyper_31_110_chunk.device_id - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_114_chunk.device_id - -> Index Only Scan using _hyper_31_114_chunk_compression_insert_device_id_time_idx on _hyper_31_114_chunk -(16 rows) + Group Key: _hyper_31_114_chunk.device_id + -> Sort + Sort Key: _hyper_31_114_chunk.device_id + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial GroupAggregate + Group Key: _hyper_31_114_chunk.device_id + -> Index Only Scan using _hyper_31_114_chunk_compression_insert_device_id_time_idx on _hyper_31_114_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk + -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk +(19 rows) SELECT device_id, count(*) FROM compression_insert @@ -1702,28 +1705,31 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate - Group Key: _hyper_31_110_chunk.device_id - -> Merge Append - Sort Key: _hyper_31_110_chunk.device_id - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk - -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_116_chunk.device_id - -> Index Only Scan using _hyper_31_116_chunk_compression_insert_device_id_time_idx on _hyper_31_116_chunk -(19 rows) + Group Key: _hyper_31_116_chunk.device_id + -> Sort + Sort Key: _hyper_31_116_chunk.device_id + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial GroupAggregate + Group Key: _hyper_31_116_chunk.device_id + -> Index Only Scan using _hyper_31_116_chunk_compression_insert_device_id_time_idx on _hyper_31_116_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk + -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk + -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk +(22 rows) SELECT device_id, count(*) FROM compression_insert @@ -1794,31 +1800,34 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate - Group Key: _hyper_31_110_chunk.device_id - -> Merge Append - Sort Key: _hyper_31_110_chunk.device_id - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk - -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_118_chunk - -> Index Scan using compress_hyper_32_119_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_119_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_118_chunk.device_id - -> Index Only Scan using _hyper_31_118_chunk_compression_insert_device_id_time_idx on _hyper_31_118_chunk -(22 rows) + Group Key: _hyper_31_118_chunk.device_id + -> Sort + Sort Key: _hyper_31_118_chunk.device_id + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial GroupAggregate + Group Key: _hyper_31_118_chunk.device_id + -> Index Only Scan using _hyper_31_118_chunk_compression_insert_device_id_time_idx on _hyper_31_118_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk + -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk + -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_118_chunk + -> Index Scan using compress_hyper_32_119_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_119_chunk +(25 rows) SELECT device_id, count(*) FROM compression_insert diff --git a/tsl/test/expected/hypercore.out b/tsl/test/expected/hypercore.out index c4ff2450f9a..e45994e3777 100644 --- a/tsl/test/expected/hypercore.out +++ b/tsl/test/expected/hypercore.out @@ -245,17 +245,15 @@ SET enable_indexscan = false; SET timescaledb.enable_transparent_decompression TO 'hypercore'; EXPLAIN (costs off, timing off, summary off) SELECT time, location, device, temp, humidity, jdata FROM :chunk WHERE device < 4 ORDER BY time, device LIMIT 5; - QUERY PLAN --------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------- Limit - -> Gather Merge - Workers Planned: 1 - -> Sort - Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device - -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk - -> Parallel Seq Scan on compress_hyper_2_32_chunk - Filter: (device < 4) -(8 rows) + -> Sort + Sort Key: _hyper_1_1_chunk."time", _hyper_1_1_chunk.device + -> Custom Scan (DecompressChunk) on _hyper_1_1_chunk + -> Seq Scan on compress_hyper_2_32_chunk + Filter: (device < 4) +(6 rows) SELECT time, location, device, temp, humidity, jdata FROM :chunk WHERE device < 4 ORDER BY time, device LIMIT 5; time | location | device | temp | humidity | jdata From e834b239ee7d4dc0b4a4becc46b1b3e6f9334810 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 23 Dec 2024 13:37:30 +0100 Subject: [PATCH 148/157] benchmark unsorted paths (2024-12-23 no. 5) From a084f90f2c9d5fd4e57acb77384b03304e1cdaba Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:43:39 +0100 Subject: [PATCH 149/157] create parallel index paths for compressed table --- .../nodes/decompress_chunk/decompress_chunk.c | 42 +++++++---- tsl/test/expected/compression_ddl.out | 75 ++++++++++--------- 2 files changed, 68 insertions(+), 49 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 2e068452a4f..709cf9bb36c 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -1000,9 +1000,12 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con compressed_rel->pathlist = NIL; compressed_rel->partial_pathlist = NIL; - /* Remove the compressed_rel from the simple_rel_array to prevent it from - * being referenced again. */ + /* + * Remove the compressed_rel from planner arrays to prevent it from being + * referenced again. + */ root->simple_rel_array[compressed_rel->relid] = NULL; + root->append_rel_array[compressed_rel->relid] = NULL; /* We should never get in the situation with no viable paths. */ Ensure(chunk_rel->pathlist, "could not create decompression path"); @@ -1913,6 +1916,22 @@ decompress_chunk_add_plannerinfo(PlannerInfo *root, CompressionInfo *info, const compressed_rel_setup_equivalence_classes(root, info); /* translate chunk_rel->joininfo for compressed_rel */ compressed_rel_setup_joininfo(compressed_rel, info); + + /* + * Force parallel plan creation, see compute_parallel_worker(). + * This is not compatible with ts_classify_relation(), but on the other hand + * the compressed chunk rel shouldn't exist anywhere outside of the + * decompression planning, it is removed at the end. + */ + compressed_rel->reloptkind = RELOPT_OTHER_MEMBER_REL; + + /* + * We have to minimally initialize the append relation info for the + * compressed chunks, so that the generate_implied_equalities() works. Only + * the parent hypertable relindex is needed. + */ + root->append_rel_array[compressed_rel->relid] = makeNode(AppendRelInfo); + root->append_rel_array[compressed_rel->relid]->parent_relid = info->ht_rel->relid; } static DecompressChunkPath * @@ -1988,24 +2007,21 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, compressed_path = create_seqscan_path(root, compressed_rel, NULL, 0); add_path(compressed_rel, compressed_path); - /* create parallel scan path */ + /* + * Create parallel scan path. + * We marked the compressed rel as RELOPT_OTHER_MEMBER_REL when creating it, + * so we should get a nonzero number of parallel workers even for small + * tables, so that they don't prevent paralellism in the entire append plan. + * See compute_parallel_workers(). This also applies to the creation of + * index paths below. + */ if (compressed_rel->consider_parallel) { - /* Almost the same functionality as ts_create_plain_partial_paths. - * - * However, we also create a partial path for small chunks to allow PostgreSQL to choose - * a parallel plan for decompression. If no partial path is present for a single chunk, - * PostgreSQL will not use a parallel plan and all chunks are decompressed by a - * non-parallel plan (even if there are a few bigger chunks). - */ int parallel_workers = compute_parallel_worker(compressed_rel, compressed_rel->pages, -1, max_parallel_workers_per_gather); - /* Use at least one worker */ - parallel_workers = Max(parallel_workers, 1); - /* Add an unordered partial path based on a parallel sequential scan. */ add_partial_path(compressed_rel, create_seqscan_path(root, compressed_rel, NULL, parallel_workers)); diff --git a/tsl/test/expected/compression_ddl.out b/tsl/test/expected/compression_ddl.out index 1d9e3ac2a61..72ee6f79f22 100644 --- a/tsl/test/expected/compression_ddl.out +++ b/tsl/test/expected/compression_ddl.out @@ -1527,22 +1527,25 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate - Group Key: _hyper_31_110_chunk.device_id - -> Merge Append - Sort Key: _hyper_31_110_chunk.device_id - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk - -> Custom Scan (VectorAgg) - -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk - -> Partial GroupAggregate - Group Key: _hyper_31_112_chunk.device_id - -> Index Only Scan using _hyper_31_112_chunk_compression_insert_device_id_time_idx on _hyper_31_112_chunk -(13 rows) + Group Key: _hyper_31_112_chunk.device_id + -> Sort + Sort Key: _hyper_31_112_chunk.device_id + -> Gather + Workers Planned: 2 + -> Parallel Append + -> Partial GroupAggregate + Group Key: _hyper_31_112_chunk.device_id + -> Parallel Index Only Scan using _hyper_31_112_chunk_compression_insert_device_id_time_idx on _hyper_31_112_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk + -> Parallel Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Custom Scan (VectorAgg) + -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk + -> Parallel Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk +(16 rows) SELECT device_id, count(*) FROM compression_insert @@ -1613,8 +1616,8 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_114_chunk.device_id -> Sort @@ -1624,16 +1627,16 @@ ORDER BY device_id; -> Parallel Append -> Partial GroupAggregate Group Key: _hyper_31_114_chunk.device_id - -> Index Only Scan using _hyper_31_114_chunk_compression_insert_device_id_time_idx on _hyper_31_114_chunk + -> Parallel Index Only Scan using _hyper_31_114_chunk_compression_insert_device_id_time_idx on _hyper_31_114_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Parallel Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Parallel Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Parallel Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk (19 rows) SELECT device_id, count(*) @@ -1705,8 +1708,8 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_116_chunk.device_id -> Sort @@ -1716,19 +1719,19 @@ ORDER BY device_id; -> Parallel Append -> Partial GroupAggregate Group Key: _hyper_31_116_chunk.device_id - -> Index Only Scan using _hyper_31_116_chunk_compression_insert_device_id_time_idx on _hyper_31_116_chunk + -> Parallel Index Only Scan using _hyper_31_116_chunk_compression_insert_device_id_time_idx on _hyper_31_116_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Parallel Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Parallel Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Parallel Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk - -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk + -> Parallel Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk (22 rows) SELECT device_id, count(*) @@ -1800,8 +1803,8 @@ EXPLAIN (costs off) SELECT device_id, count(*) FROM compression_insert GROUP BY device_id ORDER BY device_id; - QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ + QUERY PLAN +-------------------------------------------------------------------------------------------------------------------------------------------------------------- Finalize GroupAggregate Group Key: _hyper_31_118_chunk.device_id -> Sort @@ -1811,22 +1814,22 @@ ORDER BY device_id; -> Parallel Append -> Partial GroupAggregate Group Key: _hyper_31_118_chunk.device_id - -> Index Only Scan using _hyper_31_118_chunk_compression_insert_device_id_time_idx on _hyper_31_118_chunk + -> Parallel Index Only Scan using _hyper_31_118_chunk_compression_insert_device_id_time_idx on _hyper_31_118_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_110_chunk - -> Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk + -> Parallel Index Scan using compress_hyper_32_111_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_111_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_112_chunk - -> Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk + -> Parallel Index Scan using compress_hyper_32_113_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_113_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_114_chunk - -> Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk + -> Parallel Index Scan using compress_hyper_32_115_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_115_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_116_chunk - -> Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk + -> Parallel Index Scan using compress_hyper_32_117_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_117_chunk -> Custom Scan (VectorAgg) -> Custom Scan (DecompressChunk) on _hyper_31_118_chunk - -> Index Scan using compress_hyper_32_119_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_119_chunk + -> Parallel Index Scan using compress_hyper_32_119_chunk_device_id__ts_meta_min_1__ts_me_idx on compress_hyper_32_119_chunk (25 rows) SELECT device_id, count(*) From f790af46cb06df4613cf4aec2719ac0a5c716108 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:44:02 +0100 Subject: [PATCH 150/157] benchmark unsorted paths (2024-12-23 no. 6) From 96a129b00a6eefa966d8d64e0900e9e0b4abae9c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 23 Dec 2024 18:28:52 +0100 Subject: [PATCH 151/157] benchmark unsorted paths (2024-12-23 no. 8) From ad804a370f4684472c69fb2f41347b9ef10e2ddc Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:49:52 +0100 Subject: [PATCH 152/157] fix --- .../nodes/decompress_chunk/decompress_chunk.c | 33 +++++--- tsl/test/expected/vectorized_aggregation.out | 76 +++++++++---------- 2 files changed, 59 insertions(+), 50 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 709cf9bb36c..dbf6fd95819 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -1922,16 +1922,23 @@ decompress_chunk_add_plannerinfo(PlannerInfo *root, CompressionInfo *info, const * This is not compatible with ts_classify_relation(), but on the other hand * the compressed chunk rel shouldn't exist anywhere outside of the * decompression planning, it is removed at the end. + * + * This is not needed for direct select from a single chunk, in which case + * the chunk reloptkind will be RELOPT_BASEREL */ - compressed_rel->reloptkind = RELOPT_OTHER_MEMBER_REL; + if (chunk_rel->reloptkind == RELOPT_OTHER_MEMBER_REL) + { + compressed_rel->reloptkind = RELOPT_OTHER_MEMBER_REL; - /* - * We have to minimally initialize the append relation info for the - * compressed chunks, so that the generate_implied_equalities() works. Only - * the parent hypertable relindex is needed. - */ - root->append_rel_array[compressed_rel->relid] = makeNode(AppendRelInfo); - root->append_rel_array[compressed_rel->relid]->parent_relid = info->ht_rel->relid; + /* + * We have to minimally initialize the append relation info for the + * compressed chunks, so that the generate_implied_equalities() works. + * Only the parent hypertable relindex is needed. + */ + root->append_rel_array[compressed_rel->relid] = makeNode(AppendRelInfo); + root->append_rel_array[compressed_rel->relid]->parent_relid = info->ht_rel->relid; + compressed_rel->top_parent_relids = chunk_rel->top_parent_relids; + } } static DecompressChunkPath * @@ -2008,7 +2015,7 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, add_path(compressed_rel, compressed_path); /* - * Create parallel scan path. + * Create parallel seq scan path. * We marked the compressed rel as RELOPT_OTHER_MEMBER_REL when creating it, * so we should get a nonzero number of parallel workers even for small * tables, so that they don't prevent paralellism in the entire append plan. @@ -2022,9 +2029,11 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, -1, max_parallel_workers_per_gather); - /* Add an unordered partial path based on a parallel sequential scan. */ - add_partial_path(compressed_rel, - create_seqscan_path(root, compressed_rel, NULL, parallel_workers)); + if (parallel_workers > 0) + { + add_partial_path(compressed_rel, + create_seqscan_path(root, compressed_rel, NULL, parallel_workers)); + } } /* diff --git a/tsl/test/expected/vectorized_aggregation.out b/tsl/test/expected/vectorized_aggregation.out index 877f8bcfd96..3634701de2f 100644 --- a/tsl/test/expected/vectorized_aggregation.out +++ b/tsl/test/expected/vectorized_aggregation.out @@ -2341,81 +2341,81 @@ SELECT sum(int_value) FROM testtable WHERE segment_by_value > 5; Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_41_chunk Output: _hyper_1_41_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_51_chunk + -> Parallel Index Scan using compress_hyper_2_51_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_51_chunk Output: compress_hyper_2_51_chunk._ts_meta_count, compress_hyper_2_51_chunk.segment_by_value, compress_hyper_2_51_chunk._ts_meta_min_1, compress_hyper_2_51_chunk._ts_meta_max_1, compress_hyper_2_51_chunk."time", compress_hyper_2_51_chunk.int_value, compress_hyper_2_51_chunk.float_value - Filter: (compress_hyper_2_51_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_51_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_42_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_42_chunk Output: _hyper_1_42_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_52_chunk + -> Parallel Index Scan using compress_hyper_2_52_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_52_chunk Output: compress_hyper_2_52_chunk._ts_meta_count, compress_hyper_2_52_chunk.segment_by_value, compress_hyper_2_52_chunk._ts_meta_min_1, compress_hyper_2_52_chunk._ts_meta_max_1, compress_hyper_2_52_chunk."time", compress_hyper_2_52_chunk.int_value, compress_hyper_2_52_chunk.float_value - Filter: (compress_hyper_2_52_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_52_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_43_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_43_chunk Output: _hyper_1_43_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_53_chunk + -> Parallel Index Scan using compress_hyper_2_53_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_53_chunk Output: compress_hyper_2_53_chunk._ts_meta_count, compress_hyper_2_53_chunk.segment_by_value, compress_hyper_2_53_chunk._ts_meta_min_1, compress_hyper_2_53_chunk._ts_meta_max_1, compress_hyper_2_53_chunk."time", compress_hyper_2_53_chunk.int_value, compress_hyper_2_53_chunk.float_value - Filter: (compress_hyper_2_53_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_53_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_44_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_44_chunk Output: _hyper_1_44_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_54_chunk + -> Parallel Index Scan using compress_hyper_2_54_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_54_chunk Output: compress_hyper_2_54_chunk._ts_meta_count, compress_hyper_2_54_chunk.segment_by_value, compress_hyper_2_54_chunk._ts_meta_min_1, compress_hyper_2_54_chunk._ts_meta_max_1, compress_hyper_2_54_chunk."time", compress_hyper_2_54_chunk.int_value, compress_hyper_2_54_chunk.float_value - Filter: (compress_hyper_2_54_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_54_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_45_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_45_chunk Output: _hyper_1_45_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_55_chunk + -> Parallel Index Scan using compress_hyper_2_55_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_55_chunk Output: compress_hyper_2_55_chunk._ts_meta_count, compress_hyper_2_55_chunk.segment_by_value, compress_hyper_2_55_chunk._ts_meta_min_1, compress_hyper_2_55_chunk._ts_meta_max_1, compress_hyper_2_55_chunk."time", compress_hyper_2_55_chunk.int_value, compress_hyper_2_55_chunk.float_value - Filter: (compress_hyper_2_55_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_55_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_46_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_46_chunk Output: _hyper_1_46_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_56_chunk + -> Parallel Index Scan using compress_hyper_2_56_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_56_chunk Output: compress_hyper_2_56_chunk._ts_meta_count, compress_hyper_2_56_chunk.segment_by_value, compress_hyper_2_56_chunk._ts_meta_min_1, compress_hyper_2_56_chunk._ts_meta_max_1, compress_hyper_2_56_chunk."time", compress_hyper_2_56_chunk.int_value, compress_hyper_2_56_chunk.float_value - Filter: (compress_hyper_2_56_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_56_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_47_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_47_chunk Output: _hyper_1_47_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_57_chunk + -> Parallel Index Scan using compress_hyper_2_57_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_57_chunk Output: compress_hyper_2_57_chunk._ts_meta_count, compress_hyper_2_57_chunk.segment_by_value, compress_hyper_2_57_chunk._ts_meta_min_1, compress_hyper_2_57_chunk._ts_meta_max_1, compress_hyper_2_57_chunk."time", compress_hyper_2_57_chunk.int_value, compress_hyper_2_57_chunk.float_value - Filter: (compress_hyper_2_57_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_57_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_48_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_48_chunk Output: _hyper_1_48_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_58_chunk + -> Parallel Index Scan using compress_hyper_2_58_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_58_chunk Output: compress_hyper_2_58_chunk._ts_meta_count, compress_hyper_2_58_chunk.segment_by_value, compress_hyper_2_58_chunk._ts_meta_min_1, compress_hyper_2_58_chunk._ts_meta_max_1, compress_hyper_2_58_chunk."time", compress_hyper_2_58_chunk.int_value, compress_hyper_2_58_chunk.float_value - Filter: (compress_hyper_2_58_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_58_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_49_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_49_chunk Output: _hyper_1_49_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_59_chunk + -> Parallel Index Scan using compress_hyper_2_59_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_59_chunk Output: compress_hyper_2_59_chunk._ts_meta_count, compress_hyper_2_59_chunk.segment_by_value, compress_hyper_2_59_chunk._ts_meta_min_1, compress_hyper_2_59_chunk._ts_meta_max_1, compress_hyper_2_59_chunk."time", compress_hyper_2_59_chunk.int_value, compress_hyper_2_59_chunk.float_value - Filter: (compress_hyper_2_59_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_59_chunk.segment_by_value > 5) -> Custom Scan (VectorAgg) Output: (PARTIAL sum(_hyper_1_50_chunk.int_value)) Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_1_50_chunk Output: _hyper_1_50_chunk.int_value - -> Parallel Seq Scan on _timescaledb_internal.compress_hyper_2_60_chunk + -> Parallel Index Scan using compress_hyper_2_60_chunk_segment_by_value__ts_meta_min_1___idx on _timescaledb_internal.compress_hyper_2_60_chunk Output: compress_hyper_2_60_chunk._ts_meta_count, compress_hyper_2_60_chunk.segment_by_value, compress_hyper_2_60_chunk._ts_meta_min_1, compress_hyper_2_60_chunk._ts_meta_max_1, compress_hyper_2_60_chunk."time", compress_hyper_2_60_chunk.int_value, compress_hyper_2_60_chunk.float_value - Filter: (compress_hyper_2_60_chunk.segment_by_value > 5) + Index Cond: (compress_hyper_2_60_chunk.segment_by_value > 5) (86 rows) SELECT sum(int_value) FROM testtable WHERE segment_by_value > 5; @@ -3231,7 +3231,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: _hyper_3_101_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_110_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_110_chunk + -> Parallel Index Scan using compress_hyper_4_110_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_110_chunk Output: compress_hyper_4_110_chunk._ts_meta_count, compress_hyper_4_110_chunk.segment_by_value1, compress_hyper_4_110_chunk.segment_by_value2, compress_hyper_4_110_chunk._ts_meta_min_1, compress_hyper_4_110_chunk._ts_meta_max_1, compress_hyper_4_110_chunk."time", compress_hyper_4_110_chunk.int_value, compress_hyper_4_110_chunk.float_value Index Cond: ((compress_hyper_4_110_chunk.segment_by_value1 > 0) AND (compress_hyper_4_110_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3239,7 +3239,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: _hyper_3_102_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_111_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_111_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1, compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value Index Cond: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3247,7 +3247,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: _hyper_3_103_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_112_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_112_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1, compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value Index Cond: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3255,7 +3255,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: _hyper_3_104_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_113_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_113_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1, compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value Index Cond: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3263,7 +3263,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: _hyper_3_105_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_114_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_114_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1, compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value Index Cond: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3271,7 +3271,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: _hyper_3_106_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_115_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_115_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1, compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value Index Cond: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3279,7 +3279,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: _hyper_3_107_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_116_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_116_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1, compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value Index Cond: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3287,7 +3287,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: _hyper_3_108_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_117_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_117_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1, compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value Index Cond: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3295,7 +3295,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: _hyper_3_109_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_118_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_118_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1, compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value Index Cond: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) (78 rows) @@ -3315,7 +3315,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_101_chunk Output: _hyper_3_101_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_110_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_110_chunk + -> Parallel Index Scan using compress_hyper_4_110_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_110_chunk Output: compress_hyper_4_110_chunk._ts_meta_count, compress_hyper_4_110_chunk.segment_by_value1, compress_hyper_4_110_chunk.segment_by_value2, compress_hyper_4_110_chunk._ts_meta_min_1, compress_hyper_4_110_chunk._ts_meta_max_1, compress_hyper_4_110_chunk."time", compress_hyper_4_110_chunk.int_value, compress_hyper_4_110_chunk.float_value Index Cond: ((compress_hyper_4_110_chunk.segment_by_value1 > 0) AND (compress_hyper_4_110_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3323,7 +3323,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_102_chunk Output: _hyper_3_102_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_111_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_111_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_111_chunk.segment_by_value1, compress_hyper_4_111_chunk.segment_by_value2, compress_hyper_4_111_chunk._ts_meta_min_1, compress_hyper_4_111_chunk._ts_meta_max_1, compress_hyper_4_111_chunk."time", compress_hyper_4_111_chunk.int_value, compress_hyper_4_111_chunk.float_value Index Cond: ((compress_hyper_4_111_chunk.segment_by_value1 > 0) AND (compress_hyper_4_111_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3331,7 +3331,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_103_chunk Output: _hyper_3_103_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_112_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_112_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_112_chunk.segment_by_value1, compress_hyper_4_112_chunk.segment_by_value2, compress_hyper_4_112_chunk._ts_meta_min_1, compress_hyper_4_112_chunk._ts_meta_max_1, compress_hyper_4_112_chunk."time", compress_hyper_4_112_chunk.int_value, compress_hyper_4_112_chunk.float_value Index Cond: ((compress_hyper_4_112_chunk.segment_by_value1 > 0) AND (compress_hyper_4_112_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3339,7 +3339,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_104_chunk Output: _hyper_3_104_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_113_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_113_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_113_chunk.segment_by_value1, compress_hyper_4_113_chunk.segment_by_value2, compress_hyper_4_113_chunk._ts_meta_min_1, compress_hyper_4_113_chunk._ts_meta_max_1, compress_hyper_4_113_chunk."time", compress_hyper_4_113_chunk.int_value, compress_hyper_4_113_chunk.float_value Index Cond: ((compress_hyper_4_113_chunk.segment_by_value1 > 0) AND (compress_hyper_4_113_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3347,7 +3347,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_105_chunk Output: _hyper_3_105_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_114_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_114_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_114_chunk.segment_by_value1, compress_hyper_4_114_chunk.segment_by_value2, compress_hyper_4_114_chunk._ts_meta_min_1, compress_hyper_4_114_chunk._ts_meta_max_1, compress_hyper_4_114_chunk."time", compress_hyper_4_114_chunk.int_value, compress_hyper_4_114_chunk.float_value Index Cond: ((compress_hyper_4_114_chunk.segment_by_value1 > 0) AND (compress_hyper_4_114_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3355,7 +3355,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_106_chunk Output: _hyper_3_106_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_115_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_115_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_115_chunk.segment_by_value1, compress_hyper_4_115_chunk.segment_by_value2, compress_hyper_4_115_chunk._ts_meta_min_1, compress_hyper_4_115_chunk._ts_meta_max_1, compress_hyper_4_115_chunk."time", compress_hyper_4_115_chunk.int_value, compress_hyper_4_115_chunk.float_value Index Cond: ((compress_hyper_4_115_chunk.segment_by_value1 > 0) AND (compress_hyper_4_115_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3363,7 +3363,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_107_chunk Output: _hyper_3_107_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_116_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_116_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_116_chunk.segment_by_value1, compress_hyper_4_116_chunk.segment_by_value2, compress_hyper_4_116_chunk._ts_meta_min_1, compress_hyper_4_116_chunk._ts_meta_max_1, compress_hyper_4_116_chunk."time", compress_hyper_4_116_chunk.int_value, compress_hyper_4_116_chunk.float_value Index Cond: ((compress_hyper_4_116_chunk.segment_by_value1 > 0) AND (compress_hyper_4_116_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3371,7 +3371,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_108_chunk Output: _hyper_3_108_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_117_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_117_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_117_chunk.segment_by_value1, compress_hyper_4_117_chunk.segment_by_value2, compress_hyper_4_117_chunk._ts_meta_min_1, compress_hyper_4_117_chunk._ts_meta_max_1, compress_hyper_4_117_chunk."time", compress_hyper_4_117_chunk.int_value, compress_hyper_4_117_chunk.float_value Index Cond: ((compress_hyper_4_117_chunk.segment_by_value1 > 0) AND (compress_hyper_4_117_chunk.segment_by_value2 > 0)) -> Custom Scan (VectorAgg) @@ -3379,7 +3379,7 @@ SELECT sum(segment_by_value1) FROM testtable2 WHERE segment_by_value1 > 0 AND se Grouping Policy: all compressed batches -> Custom Scan (DecompressChunk) on _timescaledb_internal._hyper_3_109_chunk Output: _hyper_3_109_chunk.segment_by_value1 - -> Index Scan using compress_hyper_4_118_chunk_segment_by_value1_segment_by_val_idx on _timescaledb_internal.compress_hyper_4_118_chunk + -> Parallel 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._ts_meta_count, compress_hyper_4_118_chunk.segment_by_value1, compress_hyper_4_118_chunk.segment_by_value2, compress_hyper_4_118_chunk._ts_meta_min_1, compress_hyper_4_118_chunk._ts_meta_max_1, compress_hyper_4_118_chunk."time", compress_hyper_4_118_chunk.int_value, compress_hyper_4_118_chunk.float_value Index Cond: ((compress_hyper_4_118_chunk.segment_by_value1 > 0) AND (compress_hyper_4_118_chunk.segment_by_value2 > 0)) (78 rows) From b3beeda0ea738abcb792e1787ece0f6b60788160 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 24 Dec 2024 11:23:55 +0100 Subject: [PATCH 153/157] optimizations 1 --- .../nodes/decompress_chunk/decompress_chunk.c | 149 +++++++++++------- .../nodes/decompress_chunk/decompress_chunk.h | 4 + 2 files changed, 94 insertions(+), 59 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index dbf6fd95819..ec1eb1489f5 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -50,6 +50,9 @@ typedef struct SortInfo bool needs_sequence_num; bool can_pushdown_sort; /* sort can be pushed below DecompressChunk */ bool reverse; + + List *decompressed_sort_pathkeys; + QualCost decompressed_sort_pathkeys_cost; } SortInfo; typedef enum MergeBatchResult @@ -373,8 +376,14 @@ build_compressioninfo(PlannerInfo *root, const Hypertable *ht, const Chunk *chun info->chunk_rel = chunk_rel; info->chunk_rte = planner_rt_fetch(chunk_rel->relid, root); - Oid relid = ts_chunk_get_relid(chunk->fd.compressed_chunk_id, true); - info->settings = ts_compression_settings_get(relid); + FormData_chunk compressed_fd = ts_chunk_get_formdata(chunk->fd.compressed_chunk_id); + info->compressed_reloid = ts_get_relation_relid(NameStr(compressed_fd.schema_name), + NameStr(compressed_fd.table_name), + /* return_invalid = */ false); + info->compression_hypertable_reloid = + ts_hypertable_id_to_relid(compressed_fd.hypertable_id, /* return_invalid = */ false); + + info->settings = ts_compression_settings_get(info->compressed_reloid); if (chunk_rel->reloptkind == RELOPT_OTHER_MEMBER_REL) { @@ -754,9 +763,13 @@ can_batch_sorted_merge(PlannerInfo *root, const CompressionInfo *info, const Chu * To save planning time, we therefore refrain from adding them. */ static Path * -make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Path *compressed_path) +make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Path *compressed_path, + const SortInfo *sort_info) { - if (root->query_pathkeys == NIL) + /* + * Don't have a useful sorting after decompression. + */ + if (sort_info->decompressed_sort_pathkeys == NIL) { return NULL; } @@ -769,37 +782,6 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Pat Assert(ts_is_decompress_chunk_path(path)); - /* Iterate over the sort_pathkeys and generate all possible useful sorting */ - List *pathkey_exprs = NIL; - List *useful_pathkeys = NIL; - ListCell *lc; - foreach (lc, root->query_pathkeys) - { - PathKey *pathkey = (PathKey *) lfirst(lc); - EquivalenceClass *pathkey_ec = pathkey->pk_eclass; - - if (pathkey_ec->ec_has_volatile) - { - break; - } - - Expr *em_expr = find_em_expr_for_rel(pathkey_ec, chunk_rel); - - /* No em expression found for our rel */ - if (!em_expr) - { - break; - } - - useful_pathkeys = lappend(useful_pathkeys, pathkey); - pathkey_exprs = lappend(pathkey_exprs, em_expr); - } - - if (useful_pathkeys == NIL) - { - return NULL; - } - /* * We should be given an unsorted DecompressChunk path. */ @@ -835,14 +817,15 @@ make_chunk_sorted_path(PlannerInfo *root, RelOptInfo *chunk_rel, Path *path, Pat * partitioning code does for this case, because it must have a similar * problem. */ - QualCost pathkey_exprs_cost; - cost_qual_eval(&pathkey_exprs_cost, pathkey_exprs, root); - path_copy->custom_path.path.startup_cost += pathkey_exprs_cost.startup; + path_copy->custom_path.path.startup_cost += sort_info->decompressed_sort_pathkeys_cost.startup; path_copy->custom_path.path.total_cost += - path_copy->custom_path.path.rows * pathkey_exprs_cost.per_tuple; + path_copy->custom_path.path.rows * sort_info->decompressed_sort_pathkeys_cost.per_tuple; - Path *sorted_path = (Path *) - create_sort_path(root, chunk_rel, (Path *) path_copy, useful_pathkeys, root->limit_tuples); + Path *sorted_path = (Path *) create_sort_path(root, + chunk_rel, + (Path *) path_copy, + sort_info->decompressed_sort_pathkeys, + root->limit_tuples); return sorted_path; } @@ -1164,7 +1147,7 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf if (!sort_info->can_pushdown_sort && chunk_path_no_sort->parallel_workers == 0) { Path *sort_above_chunk = - make_chunk_sorted_path(root, chunk_rel, chunk_path_no_sort, compressed_path); + make_chunk_sorted_path(root, chunk_rel, chunk_path_no_sort, compressed_path, sort_info); if (sort_above_chunk != NULL) { decompressed_paths = lappend(decompressed_paths, sort_above_chunk); @@ -1847,24 +1830,19 @@ decompress_chunk_add_plannerinfo(PlannerInfo *root, CompressionInfo *info, const RelOptInfo *chunk_rel, bool needs_sequence_num) { Index compressed_index = root->simple_rel_array_size; - FormData_chunk compressed_fd = ts_chunk_get_formdata(chunk->fd.compressed_chunk_id); - Oid compressed_reloid = ts_get_relation_relid(NameStr(compressed_fd.schema_name), - NameStr(compressed_fd.table_name), - /* return_invalid = */ false); /* * Add the compressed chunk to the baserel cache. Note that it belongs to * a different hypertable, the internal compression table. */ - Oid compression_hypertable_reloid = - ts_hypertable_id_to_relid(compressed_fd.hypertable_id, /* return_invalid = */ false); - ts_add_baserel_cache_entry_for_chunk(compressed_reloid, - ts_planner_get_hypertable(compression_hypertable_reloid, - CACHE_FLAG_NONE)); + ts_add_baserel_cache_entry_for_chunk( + info->compressed_reloid, + ts_planner_get_hypertable(info->compression_hypertable_reloid, CACHE_FLAG_NONE)); expand_planner_arrays(root, 1); - info->compressed_rte = - decompress_chunk_make_rte(compressed_reloid, info->chunk_rte->rellockmode, root->parse); + info->compressed_rte = decompress_chunk_make_rte(info->compressed_reloid, + info->chunk_rte->rellockmode, + root->parse); root->simple_rte_array[compressed_index] = info->compressed_rte; root->parse->rtable = lappend(root->parse->rtable, info->compressed_rte); @@ -2018,7 +1996,7 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, * Create parallel seq scan path. * We marked the compressed rel as RELOPT_OTHER_MEMBER_REL when creating it, * so we should get a nonzero number of parallel workers even for small - * tables, so that they don't prevent paralellism in the entire append plan. + * tables, so that they don't prevent parallelism in the entire append plan. * See compute_parallel_workers(). This also applies to the creation of * index paths below. */ @@ -2231,17 +2209,70 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, const CompressionInfo *compression_info, List *pathkeys) { int pk_index; - PathKey *pk; Var *var; Expr *expr; char *column_name; - ListCell *lc = list_head(pathkeys); + ListCell *lc; SortInfo sort_info = { .can_pushdown_sort = false, .needs_sequence_num = false }; - if (pathkeys == NIL || ts_chunk_is_unordered(chunk)) + if (pathkeys == NIL) + { + return sort_info; + } + + /* + * Translate the pathkeys to chunk expressions, creating a List of them + * parallel to the pathkeys list, with NULL entries if we didn't find a + * match. + */ + List *chunk_em_exprs = NIL; + foreach (lc, pathkeys) + { + PathKey *pk = lfirst(lc); + EquivalenceClass *ec = pk->pk_eclass; + Expr *em_expr = NULL; + if (!ec->ec_has_volatile) + { + em_expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); + } + chunk_em_exprs = lappend(chunk_em_exprs, em_expr); + } + Assert(list_length(chunk_em_exprs) == list_length(pathkeys)); + + /* Find the pathkeys we can use for explicitly sorting after decompression. */ + List *sort_pathkey_exprs = NIL; + List *sort_pathkeys = NIL; + for (int i = 0; i < list_length(chunk_em_exprs); i++) + { + PathKey *pk = list_nth_node(PathKey, pathkeys, i); + Expr *chunk_em_expr = (Expr *) list_nth(chunk_em_exprs, i); + if (chunk_em_expr == NULL) + { + break; + } + + sort_pathkeys = lappend(sort_pathkeys, pk); + sort_pathkey_exprs = lappend(sort_pathkey_exprs, chunk_em_expr); + } + + if (sort_pathkeys == NIL) + { + return sort_info; + } + + sort_info.decompressed_sort_pathkeys = sort_pathkeys; + cost_qual_eval(&sort_info.decompressed_sort_pathkeys_cost, sort_pathkey_exprs, root); + + /* + * Next, check if we can push the sort down to the uncompressed part. + * + * Not possible if the chunk is unordered. + */ + if (ts_chunk_is_unordered(chunk)) return sort_info; /* all segmentby columns need to be prefix of pathkeys */ + lc = list_head(pathkeys); if (compression_info->num_segmentby_columns > 0) { Bitmapset *segmentby_columns; @@ -2260,7 +2291,7 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, for (; lc != NULL; lc = lnext(pathkeys, lc)) { Assert(bms_num_members(segmentby_columns) <= compression_info->num_segmentby_columns); - pk = lfirst(lc); + PathKey *pk = lfirst(lc); expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); if (expr == NULL || !IsA(expr, Var)) @@ -2300,7 +2331,7 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, for (pk_index = 1; lc != NULL; lc = lnext(pathkeys, lc), pk_index++) { bool reverse = false; - pk = lfirst(lc); + PathKey *pk = lfirst(lc); expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); if (expr == NULL || !IsA(expr, Var)) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.h b/tsl/src/nodes/decompress_chunk/decompress_chunk.h index d93d28343eb..77f2663e1a3 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.h +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.h @@ -22,6 +22,10 @@ typedef struct CompressionInfo RangeTblEntry *compressed_rte; RangeTblEntry *ht_rte; + FormData_chunk compressed_fd; + Oid compressed_reloid; + Oid compression_hypertable_reloid; + Oid compresseddata_oid; CompressionSettings *settings; From c3287de2f8583e0dc01f76260d7612b5ad30c79c Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 24 Dec 2024 11:46:06 +0100 Subject: [PATCH 154/157] optimization 2 --- .../nodes/decompress_chunk/decompress_chunk.c | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index ec1eb1489f5..cd75168eadc 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -2208,9 +2208,7 @@ static SortInfo build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, const CompressionInfo *compression_info, List *pathkeys) { - int pk_index; Var *var; - Expr *expr; char *column_name; ListCell *lc; SortInfo sort_info = { .can_pushdown_sort = false, .needs_sequence_num = false }; @@ -2272,7 +2270,7 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, return sort_info; /* all segmentby columns need to be prefix of pathkeys */ - lc = list_head(pathkeys); + int i = 0; if (compression_info->num_segmentby_columns > 0) { Bitmapset *segmentby_columns; @@ -2288,11 +2286,11 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, * we keep looping even if we found all segmentby columns in case a * columns appears both in baserestrictinfo and in ORDER BY clause */ - for (; lc != NULL; lc = lnext(pathkeys, lc)) + for (i = 0; i < list_length(pathkeys); i++) { Assert(bms_num_members(segmentby_columns) <= compression_info->num_segmentby_columns); - PathKey *pk = lfirst(lc); - expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); + + Expr *expr = (Expr *) list_nth(chunk_em_exprs, i); if (expr == NULL || !IsA(expr, Var)) break; @@ -2312,27 +2310,32 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, * if pathkeys still has items but we didn't find all segmentby columns * we cannot push down sort */ - if (lc != NULL && + if (i != list_length(pathkeys) && bms_num_members(segmentby_columns) != compression_info->num_segmentby_columns) + { return sort_info; + } } /* * if pathkeys includes columns past segmentby columns * we need sequence_num in the targetlist for ordering */ - if (lc != NULL) + if (i != list_length(pathkeys)) + { sort_info.needs_sequence_num = true; + } /* * loop over the rest of pathkeys * this needs to exactly match the configured compress_orderby */ - for (pk_index = 1; lc != NULL; lc = lnext(pathkeys, lc), pk_index++) + int compressed_pk_index = 0; + for (; i < list_length(pathkeys); i++) { - bool reverse = false; - PathKey *pk = lfirst(lc); - expr = find_em_expr_for_rel(pk->pk_eclass, compression_info->chunk_rel); + compressed_pk_index++; + PathKey *pk = list_nth_node(PathKey, pathkeys, i); + Expr *expr = (Expr *) list_nth(chunk_em_exprs, i); if (expr == NULL || !IsA(expr, Var)) return sort_info; @@ -2345,7 +2348,7 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, column_name = get_attname(compression_info->chunk_rte->relid, var->varattno, false); int orderby_index = ts_array_position(compression_info->settings->fd.orderby, column_name); - if (orderby_index != pk_index) + if (orderby_index != compressed_pk_index) return sort_info; bool orderby_desc = @@ -2358,6 +2361,7 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, * pk_strategy is either BTLessStrategyNumber (for ASC) or * BTGreaterStrategyNumber (for DESC) */ + bool reverse = false; if (pk->pk_strategy == BTLessStrategyNumber) { if (!orderby_desc && orderby_nullsfirst == pk->pk_nulls_first) @@ -2381,14 +2385,14 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, * first pathkey match determines if this is forward or backward scan * any further pathkey items need to have same direction */ - if (pk_index == 1) + if (compressed_pk_index == 1) sort_info.reverse = reverse; else if (reverse != sort_info.reverse) return sort_info; } /* all pathkeys should be processed */ - Assert(lc == NULL); + Assert(i == list_length(pathkeys)); sort_info.can_pushdown_sort = true; return sort_info; From 8db01668544b0443bb08d510570b954645c50051 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:19:46 +0100 Subject: [PATCH 155/157] optimizations..... --- .../nodes/decompress_chunk/decompress_chunk.c | 220 +++++++++++------- 1 file changed, 141 insertions(+), 79 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index cd75168eadc..38f52517db6 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -48,7 +48,8 @@ typedef struct SortInfo List *required_compressed_pathkeys; List *required_eq_classes; bool needs_sequence_num; - bool can_pushdown_sort; /* sort can be pushed below DecompressChunk */ + bool use_compressed_sort; /* sort can be pushed below DecompressChunk */ + bool use_batch_sorted_merge; bool reverse; List *decompressed_sort_pathkeys; @@ -893,7 +894,7 @@ ts_decompress_chunk_generate_paths(PlannerInfo *root, RelOptInfo *chunk_rel, con chunk_rel, sort_info.needs_sequence_num); - if (sort_info.can_pushdown_sort) + if (sort_info.use_compressed_sort) { sort_info.required_compressed_pathkeys = build_compressed_scan_pathkeys(&sort_info, @@ -1054,7 +1055,7 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * corresponding to those query_pathkeys. We will determine whether to put a sort * between the decompression node and the scan during plan creation. */ - if (sort_info->can_pushdown_sort) + if (sort_info->use_compressed_sort) { if (pathkeys_contained_in(sort_info->required_compressed_pathkeys, compressed_path->pathkeys)) @@ -1115,15 +1116,17 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * can push down the sort, the batches can be directly consumed in this * order and we don't need to use this optimization. */ - if (!sort_info->can_pushdown_sort && ts_guc_enable_decompression_sorted_merge) + if (!sort_info->use_compressed_sort && ts_guc_enable_decompression_sorted_merge) { MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); if (merge_result != MERGE_NOT_POSSIBLE) { + Assert(sort_info->use_batch_sorted_merge); DecompressChunkPath *path_copy = copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); path_copy->reverse = (merge_result != SCAN_FORWARD); + Assert(path_copy->reverse == sort_info->reverse); path_copy->batch_sorted_merge = true; /* The segment by optimization is only enabled if it can deliver the tuples in the @@ -1135,6 +1138,10 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf decompressed_paths = lappend(decompressed_paths, path_copy); } + else + { + Assert(!sort_info->use_batch_sorted_merge); + } } /* @@ -1144,7 +1151,7 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * per-worker buckets, so splitting the buckets further per-chunk is less * important. */ - if (!sort_info->can_pushdown_sort && chunk_path_no_sort->parallel_workers == 0) + if (!sort_info->use_compressed_sort && chunk_path_no_sort->parallel_workers == 0) { Path *sort_above_chunk = make_chunk_sorted_path(root, chunk_rel, chunk_path_no_sort, compressed_path, sort_info); @@ -2026,7 +2033,7 @@ create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, bool old_bitmapscan = enable_bitmapscan; enable_bitmapscan = false; - if (sort_info->can_pushdown_sort) + if (sort_info->use_compressed_sort) { /* * If we can push down sort below decompression we temporarily switch @@ -2194,6 +2201,101 @@ find_const_segmentby(RelOptInfo *chunk_rel, const CompressionInfo *info) return segmentby_columns; } +/* + * Returns whether the pathkeys starting at the given offset match the compression + * orderby, and whether the order is reverse. + */ +static bool +match_pathkeys_to_compression_orderby(List *pathkeys, List *chunk_em_exprs, + int starting_pathkey_offset, + const CompressionInfo *compression_info, bool *out_reverse) +{ + int compressed_pk_index = 0; + for (int i = starting_pathkey_offset; i < list_length(pathkeys); i++) + { + compressed_pk_index++; + PathKey *pk = list_nth_node(PathKey, pathkeys, i); + Expr *expr = (Expr *) list_nth(chunk_em_exprs, i); + + if (expr == NULL || !IsA(expr, Var)) + { + return false; + } + + Var *var = castNode(Var, expr); + + if (var->varattno <= 0) + { + return false; + } + + char *column_name = get_attname(compression_info->chunk_rte->relid, var->varattno, false); + int orderby_index = ts_array_position(compression_info->settings->fd.orderby, column_name); + + if (orderby_index != compressed_pk_index) + { + return false; + } + + bool orderby_desc = + ts_array_get_element_bool(compression_info->settings->fd.orderby_desc, orderby_index); + bool orderby_nullsfirst = + ts_array_get_element_bool(compression_info->settings->fd.orderby_nullsfirst, + orderby_index); + + /* + * pk_strategy is either BTLessStrategyNumber (for ASC) or + * BTGreaterStrategyNumber (for DESC) + */ + bool this_pathkey_reverse = false; + if (pk->pk_strategy == BTLessStrategyNumber) + { + if (!orderby_desc && orderby_nullsfirst == pk->pk_nulls_first) + { + this_pathkey_reverse = false; + } + else if (orderby_desc && orderby_nullsfirst != pk->pk_nulls_first) + { + this_pathkey_reverse = true; + } + else + { + return false; + } + } + else if (pk->pk_strategy == BTGreaterStrategyNumber) + { + if (orderby_desc && orderby_nullsfirst == pk->pk_nulls_first) + { + this_pathkey_reverse = false; + } + else if (!orderby_desc && orderby_nullsfirst != pk->pk_nulls_first) + { + this_pathkey_reverse = true; + } + else + { + return false; + } + } + + /* + * first pathkey match determines if this is forward or backward scan + * any further pathkey items need to have same direction + */ + if (compressed_pk_index == 1) + { + *out_reverse = this_pathkey_reverse; + } + else if (this_pathkey_reverse != *out_reverse) + { + return false; + } + } + + return true; +} + /* * Check if we can push down the sort below the DecompressChunk node and fill * SortInfo accordingly @@ -2211,7 +2313,7 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, Var *var; char *column_name; ListCell *lc; - SortInfo sort_info = { .can_pushdown_sort = false, .needs_sequence_num = false }; + SortInfo sort_info = { 0 }; if (pathkeys == NIL) { @@ -2307,94 +2409,54 @@ build_sortinfo(PlannerInfo *root, const Chunk *chunk, RelOptInfo *chunk_rel, } /* - * if pathkeys still has items but we didn't find all segmentby columns - * we cannot push down sort + * If pathkeys still has items, but we didn't find all segmentby columns, + * we cannot satisfy these pathkeys by sorting the compressed chunk table. */ if (i != list_length(pathkeys) && bms_num_members(segmentby_columns) != compression_info->num_segmentby_columns) { + /* + * If we didn't have any segmentby columns in pathkeys, try batch sorted merge + * instead. + */ + if (i == 0) + { + sort_info.use_batch_sorted_merge = + match_pathkeys_to_compression_orderby(pathkeys, + chunk_em_exprs, + /* starting_pathkey_offset = */ 0, + compression_info, + &sort_info.reverse); + } return sort_info; } } - /* - * if pathkeys includes columns past segmentby columns - * we need sequence_num in the targetlist for ordering - */ - if (i != list_length(pathkeys)) + if (i == list_length(pathkeys)) { - sort_info.needs_sequence_num = true; + /* + * Pathkeys satisfied by sorting the compressed data on segmentby columns. + */ + sort_info.use_compressed_sort = true; + return sort_info; } + /* + * Pathkeys includes columns past segmentby columns, so we need sequence_num + * in the targetlist for ordering. + */ + sort_info.needs_sequence_num = true; + /* * loop over the rest of pathkeys * this needs to exactly match the configured compress_orderby */ - int compressed_pk_index = 0; - for (; i < list_length(pathkeys); i++) - { - compressed_pk_index++; - PathKey *pk = list_nth_node(PathKey, pathkeys, i); - Expr *expr = (Expr *) list_nth(chunk_em_exprs, i); - - if (expr == NULL || !IsA(expr, Var)) - return sort_info; - - var = castNode(Var, expr); - - if (var->varattno <= 0) - return sort_info; - - column_name = get_attname(compression_info->chunk_rte->relid, var->varattno, false); - int orderby_index = ts_array_position(compression_info->settings->fd.orderby, column_name); - - if (orderby_index != compressed_pk_index) - return sort_info; - - bool orderby_desc = - ts_array_get_element_bool(compression_info->settings->fd.orderby_desc, orderby_index); - bool orderby_nullsfirst = - ts_array_get_element_bool(compression_info->settings->fd.orderby_nullsfirst, - orderby_index); - - /* - * pk_strategy is either BTLessStrategyNumber (for ASC) or - * BTGreaterStrategyNumber (for DESC) - */ - bool reverse = false; - if (pk->pk_strategy == BTLessStrategyNumber) - { - if (!orderby_desc && orderby_nullsfirst == pk->pk_nulls_first) - reverse = false; - else if (orderby_desc && orderby_nullsfirst != pk->pk_nulls_first) - reverse = true; - else - return sort_info; - } - else if (pk->pk_strategy == BTGreaterStrategyNumber) - { - if (orderby_desc && orderby_nullsfirst == pk->pk_nulls_first) - reverse = false; - else if (!orderby_desc && orderby_nullsfirst != pk->pk_nulls_first) - reverse = true; - else - return sort_info; - } - - /* - * first pathkey match determines if this is forward or backward scan - * any further pathkey items need to have same direction - */ - if (compressed_pk_index == 1) - sort_info.reverse = reverse; - else if (reverse != sort_info.reverse) - return sort_info; - } - - /* all pathkeys should be processed */ - Assert(i == list_length(pathkeys)); + sort_info.use_compressed_sort = match_pathkeys_to_compression_orderby(pathkeys, + chunk_em_exprs, + i, + compression_info, + &sort_info.reverse); - sort_info.can_pushdown_sort = true; return sort_info; } From d4825e480f63db2ef94853abb7e9a9da0235955f Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:23:48 +0100 Subject: [PATCH 156/157] batch sorted merge --- .../nodes/decompress_chunk/decompress_chunk.c | 244 +++++------------- 1 file changed, 70 insertions(+), 174 deletions(-) diff --git a/tsl/src/nodes/decompress_chunk/decompress_chunk.c b/tsl/src/nodes/decompress_chunk/decompress_chunk.c index 38f52517db6..bd97528c5a7 100644 --- a/tsl/src/nodes/decompress_chunk/decompress_chunk.c +++ b/tsl/src/nodes/decompress_chunk/decompress_chunk.c @@ -56,13 +56,6 @@ typedef struct SortInfo QualCost decompressed_sort_pathkeys_cost; } SortInfo; -typedef enum MergeBatchResult -{ - MERGE_NOT_POSSIBLE, - SCAN_FORWARD, - SCAN_BACKWARD -} MergeBatchResult; - static RangeTblEntry *decompress_chunk_make_rte(Oid compressed_relid, LOCKMODE lockmode, Query *parse); static void create_compressed_scan_paths(PlannerInfo *root, RelOptInfo *compressed_rel, @@ -475,8 +468,62 @@ smoothstep(double x, double start, double end) } /* - * Calculate the costs for retrieving the decompressed in-order using - * a binary heap. + * If the query 'order by' is prefix of the compression 'order by' (or equal), we can exploit + * the ordering of the individual batches to create a total ordered result without resorting + * the tuples. This speeds up all queries that use this ordering (because no sort node is + * needed). In particular, queries that use a LIMIT are speed-up because only the top elements + * of the affected batches needs to be decompressed. Without the optimization, the entire batches + * are decompressed, sorted, and then the top elements are taken from the result. + * + * The idea is to do something similar to the MergeAppend node; a BinaryHeap is used + * to merge the per segment by column sorted individual batches into a sorted result. So, we end + * up which a data flow which looks as follows: + * + * DecompressChunk + * * Decompress Batch 1 + * * Decompress Batch 2 + * * Decompress Batch 3 + * [....] + * * Decompress Batch N + * + * Using the presorted batches, we are able to open these batches dynamically. If we don't presort + * them, we would have to open all batches at the same time. This would be similar to the work the + * MergeAppend does, but this is not needed in our case and we could reduce the size of the heap and + * the amount of parallel open batches. + * + * The algorithm works as follows: + * + * (1) A sort node is placed below the decompress scan node and on top of the scan + * on the compressed chunk. This sort node uses the min/max values of the 'order by' + * columns from the metadata of the batch to get them into an order which can be + * used to merge them. + * + * [Scan on compressed chunk] -> [Sort on min/max values] -> [Decompress and merge] + * + * For example, the batches are sorted on the min value of the 'order by' metadata + * column: [0, 3] [0, 5] [3, 7] [6, 10] + * + * (2) The decompress chunk node initializes a binary heap, opens the first batch and + * decompresses the first tuple from the batch. The tuple is put on the heap. In addition + * the opened batch is marked as the most recent batch (MRB). + * + * (3) As soon as a tuple is requested from the heap, the following steps are performed: + * (3a) If the heap is empty, we are done. + * (3b) The top tuple from the heap is taken. It is checked if this tuple is from the + * MRB. If this is the case, the next batch is opened, the first tuple is decompressed, + * placed on the heap and this batch is marked as MRB. This is repeated until the + * top tuple from the heap is not from the MRB. After the top tuple is not from the + * MRB, all batches (and one ahead) which might contain the most recent tuple are + * opened and placed on the heap. + * + * In the example above, the first three batches are opened because the first two + * batches might contain tuples with a value of 0. + * (3c) The top element from the heap is removed, the next tuple from the batch is + * decompressed (if present) and placed on the heap. + * (3d) The former top tuple of the heap is returned. + * + * This function calculate the costs for retrieving the decompressed in-order + * using a binary heap. */ static void cost_batch_sorted_merge(PlannerInfo *root, const CompressionInfo *compression_info, @@ -595,149 +642,6 @@ cost_batch_sorted_merge(PlannerInfo *root, const CompressionInfo *compression_in dcpath->custom_path.path.rows * uncompressed_row_cost; } -/* - * If the query 'order by' is prefix of the compression 'order by' (or equal), we can exploit - * the ordering of the individual batches to create a total ordered result without resorting - * the tuples. This speeds up all queries that use this ordering (because no sort node is - * needed). In particular, queries that use a LIMIT are speed-up because only the top elements - * of the affected batches needs to be decompressed. Without the optimization, the entire batches - * are decompressed, sorted, and then the top elements are taken from the result. - * - * The idea is to do something similar to the MergeAppend node; a BinaryHeap is used - * to merge the per segment by column sorted individual batches into a sorted result. So, we end - * up which a data flow which looks as follows: - * - * DecompressChunk - * * Decompress Batch 1 - * * Decompress Batch 2 - * * Decompress Batch 3 - * [....] - * * Decompress Batch N - * - * Using the presorted batches, we are able to open these batches dynamically. If we don't presort - * them, we would have to open all batches at the same time. This would be similar to the work the - * MergeAppend does, but this is not needed in our case and we could reduce the size of the heap and - * the amount of parallel open batches. - * - * The algorithm works as follows: - * - * (1) A sort node is placed below the decompress scan node and on top of the scan - * on the compressed chunk. This sort node uses the min/max values of the 'order by' - * columns from the metadata of the batch to get them into an order which can be - * used to merge them. - * - * [Scan on compressed chunk] -> [Sort on min/max values] -> [Decompress and merge] - * - * For example, the batches are sorted on the min value of the 'order by' metadata - * column: [0, 3] [0, 5] [3, 7] [6, 10] - * - * (2) The decompress chunk node initializes a binary heap, opens the first batch and - * decompresses the first tuple from the batch. The tuple is put on the heap. In addition - * the opened batch is marked as the most recent batch (MRB). - * - * (3) As soon as a tuple is requested from the heap, the following steps are performed: - * (3a) If the heap is empty, we are done. - * (3b) The top tuple from the heap is taken. It is checked if this tuple is from the - * MRB. If this is the case, the next batch is opened, the first tuple is decompressed, - * placed on the heap and this batch is marked as MRB. This is repeated until the - * top tuple from the heap is not from the MRB. After the top tuple is not from the - * MRB, all batches (and one ahead) which might contain the most recent tuple are - * opened and placed on the heap. - * - * In the example above, the first three batches are opened because the first two - * batches might contain tuples with a value of 0. - * (3c) The top element from the heap is removed, the next tuple from the batch is - * decompressed (if present) and placed on the heap. - * (3d) The former top tuple of the heap is returned. - * - * This function checks if the compression 'order by' and the query 'order by' are - * compatible and the optimization can be used. - */ -static MergeBatchResult -can_batch_sorted_merge(PlannerInfo *root, const CompressionInfo *info, const Chunk *chunk) -{ - PathKey *pk; - Var *var; - Expr *expr; - char *column_name; - List *pathkeys = root->query_pathkeys; - MergeBatchResult merge_result = SCAN_FORWARD; - - /* Ensure that we have path keys and the chunk is ordered */ - if (pathkeys == NIL || ts_chunk_is_unordered(chunk)) - return MERGE_NOT_POSSIBLE; - - int nkeys = list_length(pathkeys); - - /* - * Loop over the pathkeys of the query. These pathkeys need to match the - * configured compress_orderby pathkeys. - */ - for (int pk_index = 0; pk_index < nkeys; pk_index++) - { - pk = list_nth(pathkeys, pk_index); - expr = find_em_expr_for_rel(pk->pk_eclass, info->chunk_rel); - - if (expr == NULL || !IsA(expr, Var)) - return MERGE_NOT_POSSIBLE; - - var = castNode(Var, expr); - - if (var->varattno <= 0) - return MERGE_NOT_POSSIBLE; - - column_name = get_attname(info->chunk_rte->relid, var->varattno, false); - int16 orderby_index = ts_array_position(info->settings->fd.orderby, column_name); - - if (orderby_index != pk_index + 1) - return MERGE_NOT_POSSIBLE; - - /* Check order, if the order of the first column do not match, switch to backward scan */ - Assert(pk->pk_strategy == BTLessStrategyNumber || - pk->pk_strategy == BTGreaterStrategyNumber); - - bool orderby_desc = - ts_array_get_element_bool(info->settings->fd.orderby_desc, orderby_index); - bool orderby_nullsfirst = - ts_array_get_element_bool(info->settings->fd.orderby_nullsfirst, orderby_index); - - if (pk->pk_strategy != BTLessStrategyNumber) - { - /* Test that ORDER BY and NULLS first/last do match in forward scan */ - if (orderby_desc && orderby_nullsfirst == pk->pk_nulls_first && - merge_result == SCAN_FORWARD) - continue; - /* Exact opposite in backward scan */ - else if (!orderby_desc && orderby_nullsfirst != pk->pk_nulls_first && - merge_result == SCAN_BACKWARD) - continue; - /* Switch scan direction on exact opposite order for first attribute */ - else if (!orderby_desc && orderby_nullsfirst != pk->pk_nulls_first && pk_index == 0) - merge_result = SCAN_BACKWARD; - else - return MERGE_NOT_POSSIBLE; - } - else - { - /* Test that ORDER BY and NULLS first/last do match in forward scan */ - if (!orderby_desc && orderby_nullsfirst == pk->pk_nulls_first && - merge_result == SCAN_FORWARD) - continue; - /* Exact opposite in backward scan */ - else if (orderby_desc && orderby_nullsfirst != pk->pk_nulls_first && - merge_result == SCAN_BACKWARD) - continue; - /* Switch scan direction on exact opposite order for first attribute */ - else if (orderby_desc && orderby_nullsfirst != pk->pk_nulls_first && pk_index == 0) - merge_result = SCAN_BACKWARD; - else - return MERGE_NOT_POSSIBLE; - } - } - - return merge_result; -} - /* * This function adds per-chunk sorted paths for compressed chunks if beneficial. This has two * advantages: @@ -1116,32 +1020,24 @@ build_on_single_compressed_path(PlannerInfo *root, const Chunk *chunk, RelOptInf * can push down the sort, the batches can be directly consumed in this * order and we don't need to use this optimization. */ - if (!sort_info->use_compressed_sort && ts_guc_enable_decompression_sorted_merge) + if (sort_info->use_batch_sorted_merge && ts_guc_enable_decompression_sorted_merge) { - MergeBatchResult merge_result = can_batch_sorted_merge(root, compression_info, chunk); - if (merge_result != MERGE_NOT_POSSIBLE) - { - Assert(sort_info->use_batch_sorted_merge); - DecompressChunkPath *path_copy = - copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); + Assert(!sort_info->use_compressed_sort); - path_copy->reverse = (merge_result != SCAN_FORWARD); - Assert(path_copy->reverse == sort_info->reverse); - path_copy->batch_sorted_merge = true; + DecompressChunkPath *path_copy = + copy_decompress_chunk_path((DecompressChunkPath *) chunk_path_no_sort); - /* The segment by optimization is only enabled if it can deliver the tuples in the - * same order as the query requested it. So, we can just copy the pathkeys of the - * query here. - */ - path_copy->custom_path.path.pathkeys = root->query_pathkeys; - cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); + path_copy->reverse = sort_info->reverse; + path_copy->batch_sorted_merge = true; - decompressed_paths = lappend(decompressed_paths, path_copy); - } - else - { - Assert(!sort_info->use_batch_sorted_merge); - } + /* The segment by optimization is only enabled if it can deliver the tuples in the + * same order as the query requested it. So, we can just copy the pathkeys of the + * query here. + */ + path_copy->custom_path.path.pathkeys = root->query_pathkeys; + cost_batch_sorted_merge(root, compression_info, path_copy, compressed_path); + + decompressed_paths = lappend(decompressed_paths, path_copy); } /* From 1c81dc1156c0d285afb6230297f6fe37647f0958 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Tue, 24 Dec 2024 12:27:16 +0100 Subject: [PATCH 157/157] benchmark unsorted paths (2024-12-24 no. 9)