opteryx icon indicating copy to clipboard operation
opteryx copied to clipboard

✨ `OR` to `UNION` optimizer strategy

Open joocer opened this issue 1 year ago • 0 comments

rewrite queries with complex OR segments as UNIONed queries.

as a contrived example:

SELECT * FROM $planets WHERE (id = 1) OR (name = 'Earth')

can be written as

SELECT * FROM $planets WHERE id = 1
UNION
SELECT * FROM $planets WHERE name = 'Earth'

Removing the OR condition is more likely to result in predicates being pushed, although will cost having to read the datasets twice (which can be quite expensive)

joocer avatar Feb 10 '24 23:02 joocer