Merge concurrent Eq/In filters into single In queries - #1316
Merged
Conversation
loadByFilter batched concurrent getWhere calls per entity/field/operator but still issued one storage query per distinct filter. Since all filters in a batch share the operator and field name, Eq and In batches now collapse into a single In query. Index distribution is unaffected: every loaded entity is matched against all registered filter indices. https://claude.ai/code/session_01RPHfND7Ge1qS598LWPvfif
…into claude/wonderful-heisenberg-wdjn63
Contributor
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR optimizes concurrent data loading by introducing filter merging. A new ChangesQuery Merging Optimization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
DZakh
enabled auto-merge (squash)
June 11, 2026 14:48
DZakh
pushed a commit
that referenced
this pull request
Jun 11, 2026
After #1316, batched getWhere filters collapse into fewer storage queries via EntityFilter.merge. The where-size metric now sums valuesCount over the merged queries actually sent to storage instead of the pre-merge filter batch. https://claude.ai/code/session_01Pv8B1Ed6eZkGbdeoxSnL52
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.
Optimize database queries by merging concurrent filters on the same field into fewer storage calls.
Summary
When multiple concurrent
loadByFiltercalls useEqorInfilters on the same field, they are now merged into a singleInquery. This reduces the number of database round-trips while maintaining correctness—loaded entities are matched against all registered indices, not just the merged query's filter.Changes
EntityFilter.res: Added
mergefunction that collapses homogeneous filter batches:Eqfilters on the same field → singleInfilterInfilters on the same field → singleInfilter with combined valuesGt/Lt/Andfilters remain unchanged (no lossless single-query form withoutOr)LoadLayer.res: Updated
loadByFilterto:Tests: Added comprehensive test coverage:
LoadLayer_test.res: Three new async tests verifying merge behavior forEq,In, and non-mergeableGtfiltersEntityFilter_test.res: Unit tests for themergefunction with various filter combinationshttps://claude.ai/code/session_01RPHfND7Ge1qS598LWPvfif
Summary by CodeRabbit
New Features
Tests