Update review queries to query Local Sites conditionally.

Review Request #13357 — Created Oct. 18, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

Review Board 5 introduced some mechanisms for optimizing queries to
avoid filering by Local Sites if there aren't any Local Sites in the
database. We updated a few queries to use this, but not all.

This change updates ReviewManager to take advantage of this, reducing
the complexity of queries and helping the database better use its
indexes on a typical install.

There's also a fix for building queries for Local Sites, taking
advantage of the field name provided.

This is the first in a series of changes for optimizing Local Site
filters out of queries.

All unit tests pass.

Summary ID
Update review queries to query Local Sites conditionally.
Review Board 5 introduced some mechanisms for optimizing queries to avoid filering by Local Sites if there aren't any Local Sites in the database. We updated a few queries to use this, but not all. This change updates `ReviewManager` to take advantage of this, reducing the complexity of queries and helping the database better use its indexes on a typical install. There's also a fix for building queries for Local Sites, taking advantage of the field name provided. This is the first in a series of changes for optimizing Local Site filters out of queries.
c6f57ceec9b7747c264759ee3f0fac8e41932259
Description From Last Updated

local variable 'local_site_q' is assigned to but never used Column: 13 Error code: F841

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (344e6ca)