You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create table pvagg(s int, a int);
select create_hypertable('pvagg', 'a', chunk_time_interval => 1000);
insert into pvagg select 1, generate_series(1, 999);
insert into pvagg select 2, generate_series(1001, 1999);
alter table pvagg set (timescaledb.compress, timescaledb.compress_segmentby = 's');
select count(compress_chunk(x)) from show_chunks('pvagg') x;
analyze pvagg;
set enable_indexscan to off;
explain (costs off) select count(a), s from pvagg group by s;
QUERY PLAN
──────────────────────────────────────────────────────────────────
HashAggregate
Group Key: _hyper_50_339_chunk.s
-> Append
-> Custom Scan (DecompressChunk) on _hyper_50_339_chunk
-> Sort
Sort Key: compress_hyper_51_345_chunk.s
-> Seq Scan on compress_hyper_51_345_chunk
-> Custom Scan (DecompressChunk) on _hyper_50_340_chunk
-> Sort
Sort Key: compress_hyper_51_346_chunk.s
-> Seq Scan on compress_hyper_51_346_chunk
We're doing hash aggregation here, so these Sorts are just useless work. The reason is that we don't create an unsorted version of the decompression path if the query pathkeys can be pushed down. Queries with aggregation have query pathkeys set to the grouping columns. See ts_decompress_chunk_generate_paths.
The text was updated successfully, but these errors were encountered:
akuzm
changed the title
[Bug] Uneeded sorting of compressed chunk table with aggregation
[Bug] Unneeded sorting of compressed chunk table with aggregation
May 3, 2024
akuzm
linked a pull request
May 3, 2024
that will
close
this issue
We're doing hash aggregation here, so these Sorts are just useless work. The reason is that we don't create an unsorted version of the decompression path if the query pathkeys can be pushed down. Queries with aggregation have query pathkeys set to the grouping columns. See
ts_decompress_chunk_generate_paths
.The text was updated successfully, but these errors were encountered: