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.82k stars 852 forks source link

Backport to 2.15.x: #6992: Fix sort pushdown for partially compressed chunks #7001

Closed antekresic closed 4 weeks ago

antekresic commented 4 weeks 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.

(cherry picked from commit eb548b60d1cc9bc5874cafdf2508a00694d6a44c)