Eliminate JOINs when counting starred objects using LocalSite.ALL.
Review Request #12349 — Created June 9, 2022 and submitted
This improves performance of starred review group and review request
counting when usingLocalSite.ALL
. Since we don't need to filter by
anyProfile
state in this case, we can simplify things by querying the
through
table the starred items, filtering by theProfile
's ID.This is much faster, as we don't need to JOIN any tables and the
database can more easily leverage the existing indexes.Upcoming changes to use
LocalSite.objects.has_local_sites()
will allow
us to short-cut the queries further in the common case of no Local
Sites, avoiding the JOINs on the majority of servers.
Unit tests pass.
Summary | ID |
---|---|
990eea65964e9664b869dfad06d1b5281f0195a1 |
- Change Summary:
-
Removed the
tables
options inassertQueries()
when just comparing against the model's default table. - Summary:
-
Eliminate JOINs when counting review requests using LocalSite.ALL.Eliminate JOINs when counting starred objects using LocalSite.ALL.
- Commits:
-
Summary ID 0ec19ab1e3e30a9d8334fdf4170df6572c4dd87d 990eea65964e9664b869dfad06d1b5281f0195a1