-
Notifications
You must be signed in to change notification settings - Fork 8.3k
PREWHERE for queries with FINAL #31411
Copy link
Copy link
Closed
Labels
Description
Currently, PREWHERE is not too useful for Replacing / Collapsing tables with FINAL
See #23702 #8684 #24433, etc.
At the same time one of the obvious optimizations here is very similar to PREWHERE behavior:
SELECT *
FROM replacing_mt_table FINAL
WHERE (pk_col1, pk_col2) IN
(
SELECT
pk_col1,
pk_col2
FROM replacing_mt_table
PREWHERE non_pk_col='val'
)
AND non_pk_col='val'I think it should be possible to make something similar to that rewrite during PREWHERE itself.
I.e. during the filtering of the non_pk_col 'expand' the matching ranges to a full (wider) range of those PK values.
Reactions are currently unavailable