Optimize restriction application to avoid multiple or needless sub-queries#1329
Open
Optimize restriction application to avoid multiple or needless sub-queries#1329
Conversation
f2656fd to
2cd1f96
Compare
0733aff to
5066180
Compare
This avoids several sub queries where just one is sufficient. Before: `(a=b|c=d|e=f)|(g=h|i=j|k=l)|(m=n|o=p)` After: `(a=b|c=d|e=f|g=h|i=j|k=l|m=n|o=p)` Whether this has a real advantage needs to be seen, but I think it helps the query optimizers to better optimize :D
5066180 to
6cb15ef
Compare
Jan-Schuppik
approved these changes
Feb 12, 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.
2cd1f96 Fixes that a condition, to keep redundancy groups in the result (as they cannot be subjected to restrictions), lead to expensive and irrelevant sub-queries in cases where redundancy groups were not fetched. (e.g. usergroups)
6cb15ef Changes restriction application so that restrictions of multiple roles are merged together instead of being processed individually. This helps the ORM to generate less sub-queries and I suspect performance will also be improved, even if just slightly.
fixes #1294