Skip to content

Add index to labels for `type` and project_id`

Stan Hu requested to merge sh-add-index-for-label-count into master

When loading pages that display the number of open issues, the backend runs a query such as:

SELECT "labels"."id" FROM "labels" WHERE "labels"."type" IN ('ProjectLabel') AND "labels"."project_id" = 1000

This results in an entire scan of the labels table. To optimize performance, add the appropriate index to the table.

Closes #27676 (closed)

Merge request reports