timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.83k stars 852 forks source link

Fix sort pushdown for partially compressed chunks #6992

Closed antekresic closed 1 month ago

antekresic commented 1 month ago

Using all sort pathkeys with append node for partially compressed chunks ends up creating invalid plans when using joined columns in ORDER BY clause. Using the pathkey prefix that belongs to the underlying relation fixes the issue and sets us up for possible incremental sort optimization.

Fixes #6975

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.79%. Comparing base (59f50f2) to head (af94555). Report is 194 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6992 +/- ## ========================================== + Coverage 80.06% 81.79% +1.72% ========================================== Files 190 199 +9 Lines 37181 37013 -168 Branches 9450 9671 +221 ========================================== + Hits 29770 30275 +505 + Misses 2997 2855 -142 + Partials 4414 3883 -531 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

timescale-automation commented 1 month ago

Automated backport to 2.15.x not done: cherry-pick failed.

Git status

HEAD detached at origin/2.15.x
You are currently cherry-picking commit eb548b60d.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
    new file:   .unreleased/pr_6992
    modified:   tsl/test/expected/merge_append_partially_compressed-14.out
    modified:   tsl/test/expected/merge_append_partially_compressed-15.out
    modified:   tsl/test/expected/merge_append_partially_compressed-16.out
    modified:   tsl/test/sql/merge_append_partially_compressed.sql.in

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   tsl/src/nodes/decompress_chunk/decompress_chunk.c

Job log

timescale-automation commented 1 month ago

Automated backport to 2.15.x not done: cherry-pick failed.

Git status

HEAD detached at origin/2.15.x
You are currently cherry-picking commit eb548b60d.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
    new file:   .unreleased/pr_6992
    modified:   tsl/test/expected/merge_append_partially_compressed-14.out
    modified:   tsl/test/expected/merge_append_partially_compressed-15.out
    modified:   tsl/test/expected/merge_append_partially_compressed-16.out
    modified:   tsl/test/sql/merge_append_partially_compressed.sql.in

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   tsl/src/nodes/decompress_chunk/decompress_chunk.c

Job log