Route constant-geometry spatial-relationship predicates to the TRTREE index#144
Open
estebanzimanyi wants to merge 1 commit into
Open
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. |
037aa12 to
e300988
Compare
9fa7aa0 to
60b0dbb
Compare
e300988 to
9ec3e35
Compare
60b0dbb to
f44e09c
Compare
9ec3e35 to
d25c8ef
Compare
f44e09c to
d6a3082
Compare
d25c8ef to
83eea9d
Compare
d6a3082 to
b418281
Compare
83eea9d to
27cd7ad
Compare
b418281 to
5ef40cd
Compare
27cd7ad to
dfa653a
Compare
c07d41c to
b444787
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.
b444787 to
90ed740
Compare
5d2bfb9 to
7477875
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.