Eliminate JOINs when determining LocalSite user membership.

Review Request #12351 — Created June 10, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

This updates the new User.get_local_site_stats() method to avoid
having to perform JOINs between a User and a LocalSite by way of
users or admins. We now use the through tables instead to build
the query. This simplifies the queries and allows the database to more
easily make use of the indexes established on these tables.

Unit tests pass.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Eliminate JOINs when determining LocalSite user membership.
This updates the new `User.get_local_site_stats()` method to avoid having to perform JOINs between a `User` and a `LocalSite` by way of `users` or `admins`. We now use the `through` tables instead to build the query. This simplifies the queries and allows the database to more easily make use of the indexes established on these tables.
b55ffb4bb91f7750ac587b89a46a41cafc3de1aa Christian Hammond
reviewboard/accounts/models.py
reviewboard/accounts/tests/test_user.py
Loading...