mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-29 03:11:14 +00:00
On SQLite, the `is_reusable_caller = false` filters (e.g. the admin job queue page) are planned from `IDX_action_run_job_is_reusable_caller`, which matches almost every row, so nearly the whole `action_run_job` table is read. `ANALYZE` does not help: `sqlite_stat1` only keeps average rows per key. No query needs that index. `is_reusable_caller = true` is only used by `expandedCallerCond`, always together with `repo_id` and `concurrency_group`. Their plans use other indexes on SQLite, PostgreSQL 17 and MySQL 8.4 (PostgreSQL is slightly slower with it). This removes the index tag. `SyncAllTables` drops the existing index on the next start, so no migration is needed. Job queue count on SQLite, before: a search on the `is_reusable_caller` index; after: a `MULTI-INDEX OR` on the `status` and `pickup` indexes. On an instance with about 7,000 jobs the admin job queue page went from `Page: 784ms` to `39ms` (measured with an earlier revision of this PR that gave the same plan). --------- Signed-off-by: Myers Carpenter <myers@maski.org> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>