Skip to content

fix: Add index to support trim job [DHIS2-21330] (2.43) - #25512

Merged
jason-p-pickering merged 1 commit into
2.43from
fix/DHIS2-21330-trim-index_2.43
Oct 7, 2026
Merged

jason-p-pickering merged 1 commit into
2.43from
fix/DHIS2-21330-trim-index_2.43

Conversation

@jason-p-pickering

@jason-p-pickering jason-p-pickering commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #23631 (5846b9a) to 2.43.

Implements DHIS2-21330

The DataValueTrimJob (introduced in 2.41) soft-deletes data values with null/empty values for non-zero-significant data elements. Its query required a full sequential scan of the datavalue table, more than 10 seconds on a 63M-row system, scaling linearly with table size.

A partial index on (dataelementid) WHERE deleted = false AND (value IS NULL OR value = '') reduces this to ~8ms. The index is expected to be near-empty in healthy systems, so the storage and write overhead are negligible.

The migration is added as V2_43_71. The master migration V2_44_1 uses create index if not exists, so systems upgrading from 2.43 to 2.44 skip it.

🤖 AI Assisted

Backport of #23631 (5846b9a) to 2.43 as migration V2_43_71. The
master migration V2_44_1 uses 'create index if not exists', so systems
upgrading from 2.43 to 2.44 skip it.

(cherry picked from commit 5846b9a)

🤖 AI Assisted
@jason-p-pickering
jason-p-pickering requested review from a team and netroms October 6, 2026 09:38
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@jason-p-pickering
jason-p-pickering merged commit 4942adc into 2.43 Oct 7, 2026
18 checks passed
@jason-p-pickering
jason-p-pickering deleted the fix/DHIS2-21330-trim-index_2.43 branch October 7, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants