Avoid fetching multiple times the languages enabled from the database on the search populate task
|Target version:||Release 2.6.0|
|Google Code Legacy ID:||Tested version:|
Analyzing the search index population process with Percona Monitoring and Management, one of the most demanding queries to the database seems to be one to fetch the enabled languages:
This query is executed here multiple times per document (once for the main document and, depending on the related objects, a few times more). For example, on a description with one creator, one repository and 2 related subjects, the query will be executed 5 times. Moreover, it's not very efficient as it filters using the scope column, which requires a full table scan on each run. From the metrics above (taken indexing the demo data, a really small database), it has been executed more than 10000 times and it took more than 12% of the total query time from the process.
I'm not sure if we already have the language settings cached in
sfConfig but we should try to follow that path to only execute this query once on the entire search index population process.
#4 Updated by José Raddaoui Marín about 10 hours ago
- Status changed from Code Review to QA/Review
Merged in qa/2.6.x. The query has been removed from the search populate process entirely, so that part could be tested alongside #13261.
Additionally, other places that were using the same process to get the enabled languages have been changed and should be tested too:
- Languages header menu.
- Static page edit and delete.
- User edit, translate field.
- An ES query, fro example from the search box.