Follow-up from "Post-process leaked credentials on all branches"
Let's add a new index to the security_scans
table on the pipeline_id, scan_type
column.
The following discussion from !114711 (merged) should be addressed:
-
@ahegyi started a discussion: (+2 comments) The generated query will not be efficiently batchable. Do we expect many security findings per pipeline? If not, then I'm ok leaving it as is.
Possible improvements for later:
- Add index to the
security_scans
table on thepipeline_id, scan_type
columns (reduces I/O). - Consider double iteration, only makes sense if you expect thousands of scans/finding rows:
pipeline.security_scans.by_scan_types(:secret_dtection).each_batch do |scans| scans.each do |scan| scans.findings.each_batch do |findings| # do something end end end
- Add index to the
Edited by Ahmed Hemdan