backport: perf: pre-filter geoFeatures org units by geometry [2.43]#24491
Merged
Conversation
* perf: pre-filter geoFeatures org units by geometry geoFeatures resolves the `ou` dimension into full OrganisationUnit entities, then discards every unit without geometry in-memory. On a large hierarchy (Nigeria prod: ~255k level-5 units, all null-geometry) this hydrates a quarter-million entities — ~7.6s CPU and ~4.7 GB allocated — only to return []. Thread an optional `geometryOnly` flag from DataQueryRequest through DimensionalObjectProvider and OrganisationUnitService down to HibernateOrganisationUnitStore, which appends `and o.geometry is not null`. Default off, so all other callers dispatch the original 2-arg methods unchanged. Skipped in geoJsonAttribute (coordinateField) mode, where coordinates come from an attribute and the geometry column may be null. The in-memory filter remains the precise final gate. When the geometry-filtered resolution is empty, the E7143 empty-dimension guard is suppressed so geoFeatures still returns 200 [] rather than an error. Validated on production (Nigeria, deployed on 2.40): a comparable high-level layer dropped from ~8.6s/4.7GB to 14ms/747KB. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor: bundle getDimension args into DimensionResolveOptions The private getDimension dispatcher grew to 8 parameters when geometryOnly was threaded through, tripping SonarQube java:S107 (>7 parameters). Bundle the five resolution options (relativePeriodDate, displayProperty, allowNull, inputIdScheme, geometryOnly) into a private DimensionResolveOptions record, bringing the method to 4 parameters. Behaviour is unchanged; contained entirely within DefaultDataQueryService. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jason-p-pickering
requested review from
a team,
david-mackessy,
jbee and
netroms
July 18, 2026 07:59
2 tasks
jbee
approved these changes
Jul 20, 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.



Backport of #24279