Skip to content

Comments

Optimize restriction application to avoid multiple or needless sub-queries#1329

Open
nilmerg wants to merge 2 commits intomainfrom
fix/irrelevant-filter-injections
Open

Optimize restriction application to avoid multiple or needless sub-queries#1329
nilmerg wants to merge 2 commits intomainfrom
fix/irrelevant-filter-injections

Conversation

@nilmerg
Copy link
Member

@nilmerg nilmerg commented Feb 5, 2026

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

@nilmerg nilmerg self-assigned this Feb 5, 2026
@nilmerg nilmerg added the bug Something isn't working label Feb 5, 2026
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Feb 5, 2026
@nilmerg nilmerg force-pushed the fix/irrelevant-filter-injections branch from f2656fd to 2cd1f96 Compare February 6, 2026 10:13
@nilmerg nilmerg marked this pull request as ready for review February 6, 2026 15:20
@nilmerg nilmerg requested a review from Copilot February 6, 2026 15:20
@nilmerg nilmerg changed the title Auth: Only ignore redundancy groups, if they're actually fetched Optimize restriction application to avoid multiple or needless sub-queries Feb 6, 2026

This comment was marked as resolved.

@Icinga Icinga deleted a comment from Copilot AI Feb 6, 2026
@nilmerg nilmerg force-pushed the fix/irrelevant-filter-injections branch from 0733aff to 5066180 Compare February 10, 2026 15:07
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
@nilmerg nilmerg force-pushed the fix/irrelevant-filter-injections branch from 5066180 to 6cb15ef Compare February 10, 2026 15:12
@nilmerg nilmerg requested a review from Jan-Schuppik February 11, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extremely slow usergroup filtering (30+ seconds per page load)

2 participants