Skip to content

perf(d1): avoid catalog scans for admissions - #624

Merged
harlan-zw merged 1 commit into
mainfrom
perf/admissions-page-counts
Oct 11, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
perf/admissions-page-counts

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Follow-up to #620 and #622.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Admissions scanned the resolved Skill catalog and counted Repository siblings before filtering and pagination. The query now starts from admissions and counts each returned Repository once after selecting the page.

Live D1 comparisons returned identical rows, order, sibling counts, and totals across all three boards. Populated pages read 94–98% fewer rows, including both queries. No indexes or migrations change.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Oct 11, 2026
@harlan-github-agent

harlan-github-agent Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-10-11 11:17 UTC.

GitHub merged this pull request.

No material findings were recorded.

e9fa0cbe-9538-4da6-a0e3-82ab8d16e934

@harlan-zw

Copy link
Copy Markdown
Collaborator Author

Agent verification, using read-only queries against production D1:

The previous loader and the rewrite returned identical rows, order, descriptions, stars, sibling counts, and totals. Comparisons covered pages 1, 2, and 999 on each board. Both paths used the same indexable Skill set.

Board and page Cards Reads before Reads after D1 duration before D1 duration after
Week, 1 3 22,074 428 71.4 ms 6.8 ms
Month, 1 50 22,544 1,293 76.1 ms 3.4 ms
Month, 2 14 22,544 659 75.3 ms 2.7 ms
All, 1 22 23,048 619 69.0 ms 1.8 ms

After totals include both statements on populated pages. Empty pages use one statement and preserved their full totals. Every statement reported zero rows written. Each timing is one execution, not a latency percentile. Background jobs remained active.

The first count-only rewrite still scanned about 21,400 Skill rows. Admission-first CROSS JOINs removed that scan. Live query plans showed an admission scan followed by existing Skill and Repository index lookups. Repository counts also use existing indexes.

The comparison called the actual exported loaders through a read-only D1 adapter. Raw SQL, parameters, metadata, and results are retained in the session scratchpad.

@harlan-zw harlan-zw added the harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. label Oct 11, 2026
@harlan-github-agent harlan-github-agent Bot added harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Oct 11, 2026

@harlan-github-agent harlan-github-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harlan Agent Kit posted this automated review. AI open source policy.

Automated Review: READY.

Read the Review results

@harlan-zw
harlan-zw merged commit 5dfb8de into main Oct 11, 2026
8 checks passed
@harlan-zw
harlan-zw deleted the perf/admissions-page-counts branch October 11, 2026 11:13
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Oct 11, 2026
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