perf: Fix indexes on singleevent table [DHIS2-20891]#22977
Open
enricocolasante wants to merge 1 commit intomasterfrom
Open
perf: Fix indexes on singleevent table [DHIS2-20891]#22977enricocolasante wants to merge 1 commit intomasterfrom
enricocolasante wants to merge 1 commit intomasterfrom
Conversation
822c8dd to
8b99c14
Compare
|
muilpp
approved these changes
Feb 18, 2026
ameenhere
approved these changes
Feb 18, 2026
Contributor
Why don't we see more of an effect in any of the response times? 1-2ms is not that dramatic 😅 Although definitely good from the write end to remove the overhead! |
teleivo
approved these changes
Feb 18, 2026
| drop index if exists in_singleevent_organisationunitid; | ||
| drop index if exists in_singleevent_deleted_assigneduserid; | ||
|
|
||
| -- Composite: serves date range filters, ORDER BY occurreddate, and program-only queries |
Contributor
There was a problem hiding this comment.
Why this date and not (also) others? I mean it already had an index but why this date vs another?
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.



Before (6 single-column indexes):
After (3 composite indexes, all leading with programstageid):
Following up on #22971, the key insight is that single event queries always filter by program stage — this is now explicitly enforced in
JdbcSingleEventStorewhereev.programstageid = :programstageidis added as a mandatory filter. Since programstageid is always in the WHERE clause, making it the leading column in every composite index means:Performance
Compared against 0de04dd (master at time of PR).