Add indexes on sp_action.rollout and rollout_group (#3045)

* perf(repository): add indexes on sp_idx_action_rollout_group_status and sp_idx_action_rollout_status

Rollout monitoring queries (existsByRolloutId, getStatusCountByRolloutId, getStatusCountByRolloutGroupId) filter by rollout or rollout_group on sp_action. The flyway baseline did not index either column, so Postgres
falls back to Seq Scan on every monitoring poll. With 16k action rows this is meaningful — the group-count query takes ~500 ms without the index and ~27 ms with it (Index Only Scan, Heap Fetches: 0).

Bench (16k rows, 1000 iter):
- WHERE tenant=? AND rollout_group=?           18.6x faster on PG
                                               17.6x faster on YugabyteDB
- WHERE tenant=? AND rollout=? GROUP BY status  2.5x faster on PG
                                                1.5x faster on YugabyteDB

Adds V1_20_2 sibling migrations for POSTGRESQL, H2, and MYSQL.
This commit is contained in:
clayly
2026-05-15 10:54:39 +03:00
committed by GitHub
parent 663737396c
commit eba16e529e
3 changed files with 6 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
CREATE INDEX sp_idx_action_rollout_status ON sp_action (tenant, rollout, status);
CREATE INDEX sp_idx_action_rollout_group_status ON sp_action (tenant, rollout_group, status);

View File

@@ -0,0 +1,2 @@
CREATE INDEX sp_idx_action_rollout_status ON sp_action (tenant, rollout, status);
CREATE INDEX sp_idx_action_rollout_group_status ON sp_action (tenant, rollout_group, status);

View File

@@ -0,0 +1,2 @@
CREATE INDEX sp_idx_action_rollout_status ON sp_action (tenant, rollout, status);
CREATE INDEX sp_idx_action_rollout_group_status ON sp_action (tenant, rollout_group, status);