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

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions