Skip to content

GET /api/authz/v1/assignments/ is slow due to too many queries on PolicyCacheControl #276

@mariajgrimaldi

Description

@mariajgrimaldi

Description

A trace on muscat-openedx | LMS (Mon Mar 21, 2026) showed a 28-second response time on GET /api/authz/v1/assignments/?page=1&page_size=10&search=user_.

Time breakdown: 94% view, 5% SQL, 1% other. The SQL portion consisted of 1,339 calls to openedx_authz_policycachecontrol, all reading the same row:

SELECT `openedx_authz_policycachecontrol`.`id`, `openedx_authz_policycachecontrol`.`version`
FROM `openedx_authz_policycachecontrol`
WHERE `openedx_authz_policycachecontrol`.`id` = %s LIMIT 21

ScoutAPM flagged this as an N+1 pattern and estimated 1,610ms in potential savings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions