• 
      

    Reduce unwanted queries in the Users and Groups datagrids.

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

    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.

    Summary ID
    Reduce unwanted queries in the Users and Groups datagrids.
    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.
    a25b7c7373840f9221f3b81dc8733bc279d953e1
    Description From Last Updated

    'django.db.models.Prefetch' imported but unused Column: 1 Error code: F401

    reviewbot reviewbot

    'django.http.HttpRequest' imported but unused Column: 5 Error code: F401

    reviewbot reviewbot

    Wrong version (should be 5.0.7).

    maubin maubin

    Wrong version (should be 5.0.7).

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

    flake8

    chipx86
    maubin
    1. 
        
    2. reviewboard/datagrids/grids.py (Diff revision 2)
       
       
       
      Show all issues

      Wrong version (should be 5.0.7).

    3. reviewboard/datagrids/grids.py (Diff revision 2)
       
       
       
      Show all issues

      Wrong version (should be 5.0.7).

    4. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (2486b25)