Add by_pipeline_ids scope for sbom_occurrences
What does this MR do and why?
Add by_pipeline_ids
scope for sbom_occurrences. This will be used for fetching occurrences based on pipeline_id as required by CVS on SBOM change (#464575 - closed) • Zamir Martins • 17.4
Related issue: #464575 (closed)
Query plan
The average number of occurrences per pipeline_id is 450
, the following example has the count of 63137
with the respective query plan:
Time: 3.239 ms
- planning: 3.120 ms
- execution: 0.119 ms
- I/O read: 0.000 ms
- I/O write: 0.000 ms
Shared buffers:
- hits: 10 (~80.00 KiB) from the buffer pool
- reads: 0 from the OS file cache, including disk I/O
- dirtied: 0
- writes: 0
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
> pipeline_id = Sbom::Occurrence.group(:pipeline_id).order(count: :desc).count.first.first
> Sbom::Occurrence.by_pipeline_ids(pipeline_id)
Edited by Zamir Martins