Open MatMoore opened 2 months ago
Can you add the performance improvement of the combined listDomains
& aggregateAcrossEntities
approach for totals?
Can you add the performance improvement of the combined
listDomains
&aggregateAcrossEntities
approach for totals?
The combined one took 150ms when I tested it. Here is the previous ticket, for reference https://github.com/ministryofjustice/find-moj-data/issues/644
The following query is executed as part of rendering the home page or search pages:
This takes ~500ms on its own, which slows down page loads.
Probably due to the entities subquery triggering N+1 queries on the backend.
In cases where we aren't using the total, we could take out that subquery example to speed it up 5x.
In cases where we are using the total, the following approach (150ms) also works: