Skip to content

Add new index to alert management alerts

Max Woolf requested to merge 500173-add-index-to-domain-alert-management into master

What does this MR do and why?

Query plans

Old plan

 HashAggregate  (cost=66466.59..66466.62 rows=3 width=10) (actual time=22729.710..22729.713 rows=3 loops=1)
   Group Key: alert_management_alerts.status
   Buffers: shared hit=5127 read=41960 dirtied=905
   WAL: records=1001 fpi=905 bytes=6238861
   I/O Timings: read=22415.945 write=0.000
   ->  Index Scan using index_alert_management_alerts_on_project_id_and_iid on public.alert_management_alerts  (cost=0.56..66237.76 rows=45765 width=2) (actual time=5.834..22684.086 rows=46736 loops=1)
         Index Cond: (alert_management_alerts.project_id = XXX)
         Filter: (alert_management_alerts.domain = 0)
         Rows Removed by Filter: 0
         Buffers: shared hit=5127 read=41960 dirtied=905
         WAL: records=1001 fpi=905 bytes=6238861
         I/O Timings: read=22415.945 write=0.000

New plan (now index-only scan)

 Aggregate  (cost=0.44..1825.78 rows=3 width=10) (actual time=0.315..12.651 rows=3 loops=1)
   Group Key: alert_management_alerts.status
   Buffers: shared hit=1748 read=43
   I/O Timings: read=0.389 write=0.000
   ->  Index Only Scan using idx_alerts_project_domain_status on public.alert_management_alerts  (cost=0.44..1596.74 rows=45803 width=2) (actual time=0.133..9.681 rows=46736 loops=1)
         Index Cond: ((alert_management_alerts.project_id = XXX) AND (alert_management_alerts.domain = 0))
         Heap Fetches: 2108
         Buffers: shared hit=1748 read=43
         I/O Timings: read=0.389 write=0.000
Settings: seq_page_cost = '4', work_mem = '100MB', effective_cache_size = '472585MB', jit = 'off', random_page_cost = '1.5'

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #500173 (closed)

Merge request reports

Loading