trino
trino copied to clipboard
Push one side of BETWEEN if full pushdown not possible
Description
Since value BETWEEN min AND max
is equivalent to value >= min AND value <= max, we can try to push one of the expressions down if the entire BETWEEN cannot be pushed down, leaving the other one as part of the join filter.
We do it only if the value expression is cheap to evaluate since we are going to evaluate it twice if the pushdown is successful.
fixes: https://github.com/trinodb/trino/issues/9399
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required. ( ) Release notes are required. Please propose a release note for me. ( X) Release notes are required, with the following suggested text:
# General
* Improve performance of queries with JOIN and BETWEEN predicate. ({issue}`9399`)