vulnerabilitySeveritiesCount GraphQL operation is timing out for large groups
Kibana log link: https://log.gprd.gitlab.net/app/r/s/Boi0s
See: #387771 (comment 1587471357)
Causes identified:
- Count query is not having limits. It is tough to scale count queries without limits as we cannot apply some of the known solutions like efficient in operator queries.
SELECT COUNT(*) AS "count_all", "vulnerability_reads"."severity" AS "vulnerability_reads_severity" FROM "vulnerability_reads" INNER JOIN "projects" ON "projects"."id" = "vulnerability_reads"."project_id" WHERE "vulnerability_reads"."namespace_id" IN (SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND (traversal_ids @> ('{?}'))) AND "projects"."archived" = FALSE AND "vulnerability_reads"."report_type" = 7 AND "vulnerability_reads"."state" IN (1, 4) GROUP BY "vulnerability_reads"."severity" ORDER BY "vulnerability_reads"."severity" DESC
Edited by Bala Kumar