Skip to content

Conversation

@cconard96
Copy link
Contributor

@cconard96 cconard96 commented Oct 26, 2025

Checklist before requesting a review

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.

Description

When the HLAPI does a search in the database, the process is to first fetch the main items and the foreign keys and then fetch the required data based on the foreign keys and merged with the initial results (More information can be found in the developer documentation).

The issue this PR resolves is that during the first query, the fields within the main table are fetched and then they are fetched a second time during the hydration step.

In my test searching Users with 1014 results returned, performance improved by 50% with this fix. This was the best case scenario though where there was only one or two extra DB queries needed for hydration since they were mostly empty users that had been bulk created.

This optimization cannot be applied to union searches because only the foreign key information is fetched in the initial search.

@cconard96 cconard96 marked this pull request as draft October 26, 2025 09:30
@cconard96 cconard96 force-pushed the hlapi/skip_hydrating_main_item branch from 34a7ec8 to 554e09f Compare October 26, 2025 18:43
@cconard96
Copy link
Contributor Author

This is just part of some potential performance fixes. I'd need more time to test changes to the search code to be confident it works properly in real-life use cases with no BC break, so not looking to rush this for 11.0.2.

@cconard96 cconard96 changed the title [HLAPI] Skip re-hydrating main items [HLAPI] Improve search performance Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant