[DOP-26672] Optimize paginate queries with id filters#499
Merged
Conversation
dolfinus
force-pushed
the
improvement/DOP-26672-page-limit
branch
from
July 15, 2026 13:00
cf82f2c to
f2e24e7
Compare
Coverage Report •
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dolfinus
requested review from
IlyasDevelopment and
TiGrib
and removed request for
IlyasDevelopment
July 15, 2026 13:07
dolfinus
marked this pull request as ready for review
July 15, 2026 13:07
IlyasDevelopment
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
Calling
GET /v1/runs?run_id=019f65b9-9925-709b-bbd2-a2fb181b7c99performs query which looks like this:With limit = page size (usually 20) execution plan looks like this:
With explicit
LIMIT 1PostgreSQL can skip scanning other partitions if result is already found in the first one:For case with multiple ids passed into filter (
GET /v1/run_id=019f65b9-9925-709b-bbd2-a2fb181b7c99&run_id=019f65b9-614c-7cae-a98f-8b2a4d5f119f) we fall back torun.id = ANY(:run_ids) LIMIT :len_run_idscase.Related issue number
Checklist
mddocs/docs/changelog/next_release/<pull request or issue id>.<change type>.mdfile added describing change(see CONTRIBUTING.rst for details.)