Skip to content

perf(sql): Speed up paging through large datasets - #2589

Draft
Mantisus wants to merge 2 commits into
apify:v2from
Mantisus:sql-dataset-paging
Draft

Mantisus wants to merge 2 commits into
apify:v2from
Mantisus:sql-dataset-paging

Conversation

@Mantisus

@Mantisus Mantisus commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Description

SqlStorageBackend reads a dataset page by skipping offset entries of a new (dataset_id, item_id) index and then loading only the items of the page. When a read asks for the page right after the previous one, as iterate_items, list_items and export_to do, it continues after the last item read instead of skipping offset items again, so later pages of a large dataset load as fast as the first ones. It continues only while the dataset holds the same number of items, and any other read skips offset.

Tables created before this change keep working without the new index.

Issues

Testing

  • Unit tests for the reads that continue after the previous page and the reads that skip offset.

✍️ Drafted by Claude Code

@Mantisus
Mantisus marked this pull request as draft December 4, 2026 20:39
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 4, 2026
@Mantisus Mantisus self-assigned this Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant