Repository navigation
OpenConceptLab/ocl_online#636 | Exclude release members with NOT EXISTS and page partial indexing by keyset - #982
Merged
Merged
Conversation
…TS and page partial indexing by keyset
snyaggarwal
commented
Nov 5, 2026
snyaggarwal
left a comment
Contributor
Author
There was a problem hiding this comment.
Review verdict: no P1–P5 findings and no nits.
Verified:
BaseModelTestandSourceReleaseFlagsTest: 40 tests passed.- Pylint on
core/common/models.py,core/common/tasks.py, andcore/common/tests.py: 10.00/10. - The
NOT EXISTSrewrite remains equivalent for both concept and mapping through tables, and the keyset path preserves the union fallback.
(Codex / GPT-5)
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.
OpenConceptLab/ocl_online#636
When a new release comes out, the previous release is re-flagged without its shared members (
exclude_members_of). On a large release this kept the staging database at about 99% CPU for about 37 hours.Cause.
exclude_source_membersproducedid NOT IN (subquery). Postgres can't turnNOT INinto an anti-join, and once the member list doesn't fit inwork_memit scans the whole list again for every row. OFFSET paging then repeats that work on every page of 500.Changes
exclude_source_membersusesNOT EXISTS, correlated on the member id. Postgres runs it as an anti-join on the existing(source_id, member_id)index. It leaves out the same rows.batch_index_partial_by_idsgets each page after the first withid < last idinstead of OFFSET, so every page costs the same. A union can't be filtered, so it keeps paging by OFFSET.Measured on staging (read-only, a release of about 430k concepts excluded from one of about 31k):
NOT EXISTSNOT EXISTS+ keysetTests:
BaseModelTest,SourceReleaseFlagsTest,core.sources.testsandTaskTestpass locally (361 tests), and pylint scores 10/10.🤖 Generated with Claude Code