mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Replace index role_id, action, scope with action, scope, role_id on permission table (#80336)
* Alerting: Add action, scope, role_id to permission table The existing role_id, action, scope index has the wrong ordering to be most effectively used in dashboard/folder permission requests. On a large tests set, the slow database calls were on the order of ~30-40ms, so when performed individually they don't have that large of a latency impact. However, when done in bulk in the migration this adds up to some very slow requests. After the index is added these same database calls are reduced to ~4-5ms * Change index to action, scope, role_id * Make new index unique and drop [role_id, action, scope] index
This commit is contained in:
parent
71e70c424f
commit
e45f664ca4
@ -186,4 +186,14 @@ func AddMigration(mg *migrator.Migrator) {
|
||||
mg.AddMigration("add permission identifier index", migrator.NewAddIndexMigration(permissionV1, &migrator.Index{
|
||||
Cols: []string{"identifier"},
|
||||
}))
|
||||
|
||||
mg.AddMigration("add permission action scope role_id index", migrator.NewAddIndexMigration(permissionV1, &migrator.Index{
|
||||
Type: migrator.UniqueIndex,
|
||||
Cols: []string{"action", "scope", "role_id"},
|
||||
}))
|
||||
|
||||
mg.AddMigration("remove permission role_id action scope index", migrator.NewDropIndexMigration(permissionV1, &migrator.Index{
|
||||
Type: migrator.UniqueIndex,
|
||||
Cols: []string{"role_id", "action", "scope"},
|
||||
}))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user