Repository navigation
datastore: UNION ALL for mysql list entries query - #7113
Merged
Merged
Conversation
We have seen high CPU on mysql DB. Optimizing this frequent query should help. This brings the mysql 8 and above that supports WITH clause on par with postgresql. Essentially port spiffe#4111 to buildFetchRegistrationEntriesQueryMySQLCTE. Signed-off-by: ztrain <[email protected]>
zmt
requested review from
MarcosDY,
amartinezfayo,
evan2645,
rturner3 and
sorindumitru
as code owners
July 2, 2026 19:04
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the MySQL 8+ CTE-based registration entry fetch query in the SQL datastore to avoid the UNION de-duplication step, aligning with the performance rationale previously applied to PostgreSQL.
Changes:
- Replace
UNIONwithUNION ALLinbuildFetchRegistrationEntriesQueryMySQLCTEto avoid unnecessary DISTINCT work. - Preserve query shape and ordering to keep result parsing behavior unchanged.
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.
Pull Request check list
Affected functionality
Improve performance for list registration queries in mysql 8+.
Description of change
We have seen high CPU on mysql DB. Optimizing this frequent query should help. This brings the mysql 8 and above that supports WITH clause on par with postgresql. Essentially port
#4111 to
buildFetchRegistrationEntriesQueryMySQLCTE.