Repository navigation
Conversation
Filters on values in a joined table (e.g. a value array with A_CONTAINS or A_OVERLAPS, or a negation of such a filter) took seconds to minutes on large tables when the value is frequent, because the planner had to materialize every matching row of the whole table: - A_CONTAINS with a single value and A_OVERLAPS no longer add a GROUP BY without HAVING to the IN semi-join; it does not change the result, but it kept PostgreSQL from turning the subquery into a semi-join that probes the joined table per candidate - A_CONTAINS with several values is the conjunction of one semi-join per value instead of a single subquery with GROUP BY ... HAVING count(distinct ...) = n; this also matches a list with duplicate values - the negation of a single semi-join is NOT EXISTS over the unchanged subquery instead of NOT (... IN (...)), which the planner can only evaluate per candidate or hash; it is the same predicate, as the key of the main table is never null, and the planner turns it into an anti-join The derived table of NOT EXISTS has an alias without AS, which Oracle does not accept there.
cportele
force-pushed
the
filter-array-semijoins
branch
from
October 19, 2026 17:47
7eb08a0 to
c6bd2f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Filters on values in a joined table (e.g. a value array with A_CONTAINS or A_OVERLAPS, or a negation of such a filter) took seconds to minutes on large tables when the value is frequent, because the planner had to materialize every matching row of the whole table:
The derived table of NOT EXISTS has an alias without AS, which Oracle does not accept there.