Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
57587: jobs: invert status predicate to improve query plan r=ajwerner a=ajwerner The jobs code regularly scans the set of adoptable jobs (generally small) to find if there are abandoned jobs in need of adoption. In cockroachdb#56864 we added a predicate to improve these loops to stop touching already terminal jobs. This was a big improvement in what data is written but not as big of an improvement in what data was read. When the jobs table is large, the queries, prior to this patch, performed expensive full table scans. With this patch the query plan is improved to utilize the index. Were there a check constraint indicating the allowable values of status, then the optimizer could have created the same plan. However, there isn't. Release note (bug fix): Remove system.jobs full table scan which is expensive in the face of many completed jobs. Co-authored-by: Andrew Werner <[email protected]>
- Loading branch information