Route constant-geometry spatial-relationship predicates to the TRTREE index - #144
Closed
estebanzimanyi wants to merge 1 commit into
Closed
Route constant-geometry spatial-relationship predicates to the TRTREE index#144estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
Member
Author
Reviewer's quickstart — ~6 minutesWhat this PR does in one sentence: when a spatial-rel predicate has a constant geometry on one side (e.g. Files (4):
Verification: CREATE INDEX rt ON trips USING TRTREE (traj);
EXPLAIN SELECT count(*) FROM trips WHERE eIntersects(traj, 'POLYGON(...)'::GEOMETRY);
-- Before this PR: SEQ_SCAN. After: TRTREE_INDEX_SCAN.Cross-link: stacked on #143 (MEST multi-entry indexing), which is in turn the foundation for this optimisation. Both will rebuild cleanly once #161 lands (Linux arm64 build). Why it's safe to merge: the pre-existing scan path remains available for non-constant-geometry cases; this only adds a new index-aware branch. |
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
May 29, 2026 21:36
037aa12 to
e300988
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
from
May 29, 2026 21:36
9fa7aa0 to
60b0dbb
Compare
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
May 29, 2026 21:38
e300988 to
9ec3e35
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
from
May 29, 2026 21:38
60b0dbb to
f44e09c
Compare
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
May 30, 2026 05:15
9ec3e35 to
d25c8ef
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
from
May 30, 2026 05:15
f44e09c to
d6a3082
Compare
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
June 5, 2026 17:08
d25c8ef to
83eea9d
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
from
June 5, 2026 17:08
d6a3082 to
b418281
Compare
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
June 5, 2026 17:15
83eea9d to
27cd7ad
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
from
June 5, 2026 17:15
b418281 to
5ef40cd
Compare
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
June 5, 2026 18:42
27cd7ad to
dfa653a
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
5 times, most recently
from
June 6, 2026 07:15
b444787 to
90ed740
Compare
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
June 6, 2026 07:15
5d2bfb9 to
7477875
Compare
… index eIntersects/eContains/eDisjoint/eTouches against a constant geometry are now recognised by the TRTREE scan optimizer, which synthesizes the bounding-box && prefilter from the constant and probes the index (single-box or MEST). The bbox is a lossy superset, so the index scan reports supports_pushdown_type = false and DuckDB keeps the original predicate as an exact recheck filter above the scan, mirroring the lossy-index-always-rechecks contract of PostGIS GiST and MobilityDB's tspatial_supportfn. A parity block proves that a row whose bbox overlaps the query polygon but does not actually intersect it is dropped, identically with and without the index and under MEST multi-entry.
estebanzimanyi
force-pushed
the
feat/trtree-mest-multientry
branch
from
June 6, 2026 23:48
7477875 to
a110265
Compare
estebanzimanyi
force-pushed
the
feat/trtree-spatialrel-pushdown
branch
from
June 6, 2026 23:48
90ed740 to
a346fc0
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.
eIntersects, eContains, eDisjoint and eTouches against a constant geometry are recognised by the TRTREE scan optimizer, which synthesizes the bounding-box && prefilter from the constant and probes the index (single-box or MEST). The bbox is a lossy superset, so the index scan reports supports_pushdown_type = false and DuckDB keeps the original predicate as an exact recheck filter above the scan, mirroring the lossy-index-always-rechecks contract of PostGIS GiST and MobilityDB's tspatial_supportfn. A parity block proves that a row whose bounding box overlaps the query polygon but does not actually intersect it is dropped, identically with and without the index and under MEST multi-entry. Stacked on #143; its commits show in the diff until it merges.