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

Fix `corresponding equivalence member not found` #7080

Closed svenklemm closed 1 day ago

svenklemm commented 2 days ago

When querying compressed data we determine whether the requested ORDER can be applied to the underlying query on the compressed data itself. This happens twice. The first time we decide whether we can push down the sort and then we do a recheck when we setup the sort metadata. Unfortunately those two checks did not agree. The initial check concluded it is possible but the recheck disagreed. This was due to a bug when checking the query properties we mixed up the attnos and used attnos from uncompressed chunk and compressed chunk in the same bitmapset. If a segmentby column with equality constraint was present in the WHERE clause whose attno was identical to a compressed attno of a different column that was part of the ORDER BY the recheck would fail.

This patch removes the recheck and relies on the initial assesment when building sort metadata.

codecov[bot] commented 2 days ago

Codecov Report

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

Project coverage is 81.77%. Comparing base (59f50f2) to head (c3417a4). Report is 233 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7080 +/- ## ========================================== + Coverage 80.06% 81.77% +1.70% ========================================== Files 190 200 +10 Lines 37181 37349 +168 Branches 9450 9743 +293 ========================================== + Hits 29770 30541 +771 + Misses 2997 2894 -103 + Partials 4414 3914 -500 ```

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