Reduce unwanted queries in the Users and Groups datagrids.

Review Request #13422 — Created Nov. 15, 2023 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

The Users and Groups datagrids both had extra queries conducted per-row,
some due to columns and some due to URL generation.

The Users datagrid was fetching associated review request counts
per-row. The Groups datagrid was fetching Local Sites (when applicable),
associated review request counts, and associated membership counts.

We now use a combination of column-specific and datagrid-specific
query augmentation to select-related or prefetch-related the queries we
need.

The Users datagrid tests have also been updated to ensure all profiles
are pre-created for the tests. This avoids an INSERT for each missing
profile. That may occur in the real world still, when importing users
who haven't logged in yet, but only the first time the profile is
accessed, so it's not worth optimizing around that.

Unit tests pass.

Tested the datagrids manually, making sure all columns and links still
work.

Commits

Files

    Loading...