Skip to content

Bound collection candidate D1 work - #40

Merged
droplister merged 1 commit into
mainfrom
fix/cloudflare-candidate-query
Oct 29, 2026
Merged

droplister merged 1 commit into
mainfrom
fix/cloudflare-candidate-query

Conversation

@droplister

Copy link
Copy Markdown
Member

Summary

  • aggregate collector holdings before joining asset metadata and collection evidence
  • drive collector selection through the existing positive-holdings partial index
  • evaluate the collector persona only for chosen acquirers in stage two
  • pass all 150 seed asset IDs through one JSON bind, eliminating five repeated collector scans without crossing D1's SQL-variable ceiling
  • add an end-to-end query fixture covering the five-holder floor, known-collection and low-quality exclusions, dominant-airdrop suppression, and chosen acquisition evidence

Production proof

The cold collection-candidate seed query was capable of saturating D1 and causing unrelated routes to return D1 DB is overloaded.

Exact before/after runs over the live database with deterministic tie ordering returned the same 150 rows:

  • before: 3,265,649 rows read; 7,465 ms
  • after: 1,561,486 rows read; 2,329 ms
  • after with the existing positive-holdings partial index explicitly selected: 1,381,322 rows read; 2,143 ms
  • result parity: exact equality across every returned field

Stage two previously materialized the complete collector population five times in 30-asset batches. One 150-asset JSON batch measured 3,104,700 rows versus roughly 10M across five batches; evaluating the persona after the target acquisition join reduced that further to 2,492,062 rows and 3,405 ms.

No schema or response-shape changes.

Verification

pm test -w xcp-api: 469 passed, 0 failed (34 live-contract tests skipped locally by design)

pm run check: typecheck, ESLint, Prettier, and structure checks passed

@droplister
droplister merged commit 594618b into main Oct 29, 2026
2 checks passed
@droplister
droplister deleted the fix/cloudflare-candidate-query branch October 29, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant