Skip to content

Unindexed builds: cover from WKB and intersect before materializing records (#439 for the live path)Β #445

Description

@espg

πŸ€– from Claude

Surfaced by espg's post-#440 demo rerun (2026-08-16): the unindexed polygon-direct build is still record-decode-first β€” issue #439's inversion was applied only to the stored-index path. Measured on the 555,867-granule ATL03 clone, California AOI, o9:

Structurally the no-index build computes the same thing as index-then-query, yet costs ~2.5Γ— their sum. Two inherited inefficiencies:

  1. _intersect_mortie consumes decoded ring coordinates from granule records, so granule_records() runs over every row before any intersection β€” the exact pattern Stored-index query path: intersect before materializing granule recordsΒ #439 removed from the indexed path.
  2. The live cover runs from the decoded rings rather than the raw WKB column; index_footprints's from_wkbs covers the same 555k footprints in ~32 s vs the ~60 s in-build cover+intersect.

Proposed fix (the #439 ruling extended): the unindexed mortie-backend build becomes build-an-ephemeral-index-and-query-it β€” cover from the WKB column (from_wkbs, no records), intersect positionally (the same _intersect_footprint_cells machinery, values/offsets in memory), then materialize records for hit rows only via the existing _hit_records. Expected: no-index β‰ˆ the cover cost (~33-35 s at clone scale), and the code path largely unifies with the stored-index plan (one intersection engine; "indexed" = the cover was persisted). Care points carry over from #440: screen-predicate parity (granule_row_mask), total_granules stability, the MultiPolygon superset disclosure (from_wkbs covers all parts β€” the live path would inherit the index's documented superset semantics, a small behavioral delta vs today's largest-ring cover that must be disclosed like #441's schema note), and the paired-asset exclusion (PR #432's resolution: paired builds stay eager).

Refs #439 (the indexed-path inversion, PR #440), #396, #400, PR #432 (paired-build exclusivity).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions