SWATCH-4281: Reduce eager loading for unneeded collection#5699
Open
SWATCH-4281: Reduce eager loading for unneeded collection#5699
Conversation
83b0850 to
e9b1710
Compare
|
⛏️ Workflow Run 🧪 JUnit
Details
|
||||||||||||||
047c3fb to
15a07d6
Compare
c944cb3 to
87d2b63
Compare
96c7240 to
69eb18d
Compare
awood
previously approved these changes
Mar 5, 2026
| SELECT h FROM Host h | ||
| LEFT JOIN FETCH h.monthlyTotals | ||
| """) | ||
| List<Host> findAllEagerly(); |
Collaborator
There was a problem hiding this comment.
Suggested change
| List<Host> findAllEagerly(); | |
| /* Used in testing since we don't have a session that can resolve the proxy objects associated with a | |
| * lazy fetch */ | |
| List<Host> findAllEagerly(); |
69eb18d to
ae26828
Compare
- Targets a specific scenario where monthly totals are not used
ae26828 to
8284988
Compare
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.
Jira issue: SWATCH-4281
Description
In an effort to reduce the data loaded during a nightly tally, we can stop loading instance_montly_totals when loading the hosts. This will save time and memory during this run.
Testing
Setup
make clean installpodman compose up -d./import_hbi_hosts_by_org.sh --org-id=4592029 --batch-modepython import-from-gabi.py --org-id=4592029 --systemsSERVER_PORT=8010 ./mvnw -pl swatch-tally spring-boot:run -DskipTests -Dspring-boot.run.arguments="--logging.level.org.hibernate.SQL=DEBUG" > test.logSteps
http PUT ":8010/api/rhsm-subscriptions/v1/internal/rpc/tally/snapshots/4592029" x-rh-swatch-psk:placeholderVerification
[DEBUG] [org.hibernate.SQL] - select h1_0.id,h1_0.billing_account_id,h1_0.billing_provider,b1_0.host_id,b1_0.as_hypervisor,b1_0.billing_account_id,b1_0.billing_provider,b1_0.product_id,b1_0.sla,b1_0.usage,b1_0.cores,b1_0.measurement_type,b1_0.sockets,b1_0.version,h1_0.cloud_provider,h1_0.display_name,h1_0.is_guest,h1_0.hardware_type,h1_0.hypervisor_uuid,h1_0.insights_id,h1_0.instance_id,h1_0.instance_type,h1_0.inventory_id,h1_0.is_hypervisor,h1_0.is_unmapped_guest,laerdbst1_0.host_id,laerdbst1_0.service_type,laerdbst1_0.last_applied_event_record_date,h1_0.last_seen,m1_0.host_id,m1_0.metric_id,m1_0.value,h1_0.num_of_guests,h1_0.org_id,h1_0.subscription_manager_id from hosts h1_0 left join instance_measurements m1_0 on h1_0.id=m1_0.host_id left join host_tally_buckets b1_0 on h1_0.id=b1_0.host_id left join host_tally_service_type laerdbst1_0 on h1_0.id=laerdbst1_0.host_id where h1_0.org_id=? and h1_0.instance_type='HBI_HOST' order by coalesce(h1_0.hypervisor_uuid,h1_0.subscription_manager_id),h1_0.hypervisor_uuid,h1_0.inventory_id,h1_0.id