Backfill aggregated boolean columns in security_inventory_filters
What does this MR do and why?
Backfill aggregated boolean columns has_scanners, has_failed_or_warning and has_stale in security_inventory_filters table.
Changelog: added
EE: true
Query plans
Raw SQL
UPDATE
"security_inventory_filters"
SET
has_scanners = (sast != 0
OR sast_advanced != 0
OR sast_iac != 0
OR dast != 0
OR dependency_scanning != 0
OR coverage_fuzzing != 0
OR api_fuzzing != 0
OR cluster_image_scanning != 0
OR secret_detection != 0
OR secret_detection_secret_push_protection != 0
OR secret_detection_pipeline_based != 0
OR container_scanning != 0
OR container_scanning_for_registry != 0
OR container_scanning_pipeline_based != 0),
has_failed_or_warning = (sast = 2
OR sast_advanced = 2
OR sast_iac = 2
OR dast = 2
OR dependency_scanning = 2
OR coverage_fuzzing = 2
OR api_fuzzing = 2
OR cluster_image_scanning = 2
OR secret_detection = 2
OR secret_detection_secret_push_protection = 2
OR secret_detection_pipeline_based = 2
OR container_scanning = 2
OR container_scanning_for_registry = 2
OR container_scanning_pipeline_based = 2),
has_stale = (sast = 3
OR sast_advanced = 3
OR sast_iac = 3
OR dast = 3
OR dependency_scanning = 3
OR coverage_fuzzing = 3
OR api_fuzzing = 3
OR cluster_image_scanning = 3
OR secret_detection = 3
OR secret_detection_secret_push_protection = 3
OR secret_detection_pipeline_based = 3
OR container_scanning = 3
OR container_scanning_for_registry = 3
OR container_scanning_pipeline_based = 3)
WHERE
"security_inventory_filters"."id" BETWEEN 1 AND 50
AND "security_inventory_filters"."id" >=1
Plan
See this.
ModifyTable on public.security_inventory_filters (cost=0.43..13.02 rows=0 width=0) (actual time=104.331..104.331 rows=0 loops=1)
Buffers: shared hit=263 read=135 dirtied=89
WAL: records=141 fpi=85 bytes=556422
-> Index Scan using security_inventory_filters_pkey on public.security_inventory_filters (cost=0.43..13.02 rows=12 width=9) (actual time=0.041..41.654 rows=41 loops=1)
Index Cond: ((security_inventory_filters.id >= 1) AND (security_inventory_filters.id <= 50) AND (security_inventory_filters.id >= 1))
Buffers: shared hit=14 read=43 dirtied=28
WAL: records=47 fpi=28 bytes=217538
Settings: work_mem = '100MB', seq_page_cost = '4', effective_cache_size = '338688MB', jit = 'off', random_page_cost = '1.5'MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to [Backend] Implementation suggestion: Aggregated... (#596691) • Gal Katz
Edited by Gal Katz