You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The LeftJoin in the plan above will produce row for every match. However, only single match is required to determine that exists == true for particular probe row.
To improve this we could add a new JoinNode flag, e.g: boolean singleMatch which would stop enumerating matches after a single hit.
Perhaps we could refactor or remove JoinNode#maySkipOutputDuplicates, which doesn't help here because join operator cannot stop enumerating matches when maySkipOutputDuplicates==true since subquery_true is not part of equi-clauses (see
// Implementation of hash join operator may only take advantage of output duplicates insensitive joins when:
)
Alternatively, we could determine that subquery_true is constant expression, which would allow us to skip output duplicates when maySkipOutputDuplicates==true. That might require having "traits" as part of Reference (cc @martint )
Correlated
NOT EXISTS
queries likeare rewritten to:
The
LeftJoin
in the plan above will produce row for every match. However, only single match is required to determine thatexists == true
for particular probe row.To improve this we could add a new
JoinNode
flag, e.g:boolean singleMatch
which would stop enumerating matches after a single hit.Perhaps we could refactor or remove
JoinNode#maySkipOutputDuplicates
, which doesn't help here because join operator cannot stop enumerating matches whenmaySkipOutputDuplicates==true
sincesubquery_true
is not part of equi-clauses (seetrino/core/trino-main/src/main/java/io/trino/sql/planner/LocalExecutionPlanner.java
Line 2781 in dac669f
Alternatively, we could determine that
subquery_true
is constant expression, which would allow us to skip output duplicates whenmaySkipOutputDuplicates==true
. That might require having "traits" as part ofReference
(cc @martint )cc @Dith3r
The text was updated successfully, but these errors were encountered: