Eliminate JOINs when counting starred objects using LocalSite.ALL.

Review Request #12349 — Created June 9, 2022 and submitted

chipx86
Review Board
release-5.0.x
reviewboard

This improves performance of starred review group and review request
counting when using LocalSite.ALL. Since we don't need to filter by
any Profile state in this case, we can simplify things by querying the
through table the starred items, filtering by the Profile'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
Eliminate JOINs when counting review requests using LocalSite.ALL.
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (b9ea864)
Loading...