Skip to content

Use cursor pagination for backfill query to improve performance.#700

Merged
ggreer merged 1 commit intomainfrom
ggreer/backfill-faster
Feb 21, 2026
Merged

Use cursor pagination for backfill query to improve performance.#700
ggreer merged 1 commit intomainfrom
ggreer/backfill-faster

Conversation

@ggreer
Copy link
Contributor

@ggreer ggreer commented Feb 21, 2026

Summary by CodeRabbit

  • Chores
    • Improved grant data processing performance through more efficient batching of database operations.

@coderabbitai
Copy link

coderabbitai bot commented Feb 21, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

The backfillGrantExpansionColumn function has been refactored to implement cursor-based pagination using row IDs instead of rescanning from the beginning. A lastID variable tracks pagination progress, the query filters rows with g.id > lastID, and batches are limited to 1000 rows.

Changes

Cohort / File(s) Summary
Pagination Optimization
pkg/dotc1z/grants.go
Refactored backfillGrantExpansionColumn to use cursor-based pagination via ID tracking. Added lastID variable to filter and paginate through rows incrementally, reducing redundant scans and improving efficiency when processing large datasets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 With cursor in paw, this rabbit hops fast,
No more scanning the whole dataset past!
By ID we now bound, through records we race,
Pagination optimized—a much speedier place!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Use cursor pagination for backfill query to improve performance' directly and accurately describes the main change: replacing offset-based pagination with cursor-based pagination in the backfillGrantExpansionColumn function.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ggreer/backfill-faster

Comment @coderabbitai help to get the list of available commands and usage tips.

@ggreer ggreer merged commit 0a893bd into main Feb 21, 2026
6 checks passed
@ggreer ggreer deleted the ggreer/backfill-faster branch February 21, 2026 22:39
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.

2 participants