Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update alert group search to force index in MySQL (#4731)
Related to grafana/oncall-private#2679 Confirmed the query rewriting works via MySQL query logs (index is also forced for the stats queries): `2024-07-24T19:50:59.482751Z 3977 Query SELECT `alerts_alertgroup`.`id` FROM `alerts_alertgroup` FORCE INDEX (`alert_group_list_index`) WHERE (`alerts_alertgroup`.`channel_id` IN (13) AND (1) AND (`alerts_alertgroup`.`public_primary_key` LIKE 'test' OR `alerts_alertgroup`.`inside_organization_number` LIKE 'test' OR `alerts_alertgroup`.`web_title_cache` LIKE '%test%') AND `alerts_alertgroup`.`root_alert_group_id` IS NULL AND ((`alerts_alertgroup`.`silenced` = ('0') AND `alerts_alertgroup`.`acknowledged` = ('0') AND `alerts_alertgroup`.`resolved` = ('0')) OR (`alerts_alertgroup`.`acknowledged` = ('1') AND `alerts_alertgroup`.`resolved` = ('0'))) AND `alerts_alertgroup`.`started_at` >= '2024-06-24 19:50:58' AND `alerts_alertgroup`.`started_at` <= '2024-07-24 19:50:58') ORDER BY `alerts_alertgroup`.`started_at` DESC LIMIT 26 ` Rewriting will only be applied to the alert group search queries, when the feature flags are enabled. Dependency was already listed as a requirement.
- Loading branch information