The models/actions/run.go:GetRunBefore function sorts ActionRun rows to get the most recently stopped. Since the ActionRun rows do not expire, the cost will keep increasing over time.
The index is meant to ensure the execution time of the associated query does not grow linearly with the number of rows in the ActionRun table.
Ref https://codeberg.org/forgejo/forgejo/pulls/7491/files#issuecomment-5495441
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8252
Reviewed-by: Christopher Besch <mail@chris-besch.com>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>