Switch to using an EXISTS query
What does this MR do and why?
Before:
SELECT
"security_findings".*
FROM
"security_findings"
INNER JOIN "security_scans" ON "security_findings"."scan_id" = "security_scans"."id"
WHERE
"security_scans"."pipeline_id" = 832983315
LIMIT 1
- Current:
hits: 65 (~520.00 KiB) from the buffer pool
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/17711/commands/59142
After:
SELECT 1 AS one
FROM "security_findings"
INNER JOIN "security_scans" ON "security_findings"."scan_id" = "security_scans"."id"
WHERE "security_scans"."pipeline_id" = 600 AND (finding_data <> '{}')
LIMIT 1;
- EXISTS:
hits: 7 (~56.00 KiB) from the buffer pool
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/17725/commands/59158
- https://gitlab.com/gitlab-com/sec-sub-department/section-sec-request-for-help/-/issues/29
- !117290 (comment 1351848607)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by mo khan