Use MEST multi-entry indexing in the TRTREE index#143
Conversation
Reviewer's quickstart — ~5 minutesWhat this PR does in one sentence: switches the TRTREE index from single-entry per row to multi-entry indexing (MEST) — every spatial bbox of a temporal trajectory's component segments becomes an index entry, dramatically improving recall for spatial predicates. Files (5):
Why it matters: previously a single trajectory got ONE bbox in the index — that bbox is loose (covers the whole trajectory's extent), so queries with small predicate polygons returned huge false-positive sets that had to be re-filtered. With MEST, each segment's bbox is indexed separately; a small predicate polygon hits only the relevant segments. Foundational for: #144 (constant-geometry pushdown — depends on the multi-entry structure existing). Cross-link: Linux arm64 build needs #161. Why it's safe to merge: the index becomes strictly more precise — never lower recall (every old entry still maps to the trajectory it came from), never wrong results. Build cost goes up (more entries), query cost goes down (less false-positive filtering). |
037aa12 to
e300988
Compare
54e3c44 to
0af64ae
Compare
9ec3e35 to
d25c8ef
Compare
0af64ae to
fff43eb
Compare
d25c8ef to
83eea9d
Compare
fff43eb to
fbf9182
Compare
83eea9d to
27cd7ad
Compare
fbf9182 to
4995a85
Compare
27cd7ad to
dfa653a
Compare
4995a85 to
bcbfe19
Compare
0f53ed4 to
648c951
Compare
Build the TRTREE index with MEST multi-entry indexing, make it SRID-agnostic, and fix multi-column projection.
02dfc34 to
9fd27c5
Compare
648c951 to
5d2bfb9
Compare
A temporal column was indexed as a single minimum bounding box per row, so a wiggly or high-extent trajectory matched far more query boxes than it actually overlapped. Construct now indexes each temporal value as up to max_boxes tight per-segment bounding boxes via the MEOS rtree_insert_temporal_split (degenerating to the previous single-box behaviour for instants or max_boxes <= 1); temporal-spatial values are SRID-normalised to 0 before splitting so every produced stbox matches the SRID-stripped query box, and Search deduplicates row ids with a seen-set because multi-entry leaves return the same id once per overlapping segment box. The split bound is exposed as WITH (max_boxes = N), default 8, validated on the MEST selectivity benchmark (false-positive rate 47.2 percent single-box to 13.8 percent at 8). The portfile.cmake change here pins MEOS at the MEST commit only as a TEMPORARY BUILD-BASE so this PR is green in isolation; it deliberately conflicts with the wasm pin work in #142. At finalization this PR drops the portfile edit entirely and inherits #142s pin, which requires MobilityDB #1032 (MEST) to be merged to master alongside #1036 (wasm) so a single master commit carries both; the MobilityDuck merge order is #134, #136, #137, #138, #140, #141, #142, then #139, then this PR. Stacked on the TRTREE crash fix (fix/trtree-index-assertion).